-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathluakitsession
executable file
·71 lines (56 loc) · 1.55 KB
/
luakitsession
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
#
# Script that starts a named session of luakit
#
# Set usage output
USAGE="[-h |--help] <session>"
LONGUSAGE="\t-h, --help\n\t\tPrint this help message
\t-d, --delete\n\t\tDelete a session, rather than starting it.
\t<session>\n\t\tName of session."
# Standard functions
source ${SCRIPTS}/functions.sh
# Script name
ME=$(basename $0)
# Parse arguments
ARGS=`getopt -o hd --long help,delete -n "${ME}" -- "$@"`
if [ $? != 0 ] ; then
usage
fi
eval set -- "$ARGS"
while true ; do
case "$1" in
-h|--help) usage; shift ;;
-d|--delete) DELETE=yes; shift ;;
--) shift ; break ;;
* ) usage "Invalid argument $1";;
esac
done
# Remaining arguments are in $1, $2, etc. as normal
if [ -z "$1" ]; then
usage "Must give session name"
fi
SESSION="$1"
OLD_DATA="${XDG_DATA_HOME:-${HOME}/.local/share}"
OLD_CACHE="${XDG_CACHE_HOME:-${HOME}/.cache}"
export XDG_DATA_HOME=${OLD_DATA}/sessions/${SESSION}/
export XDG_CACHE_HOME=${OLD_CACHE}/sessions/${SESSION}/
if [ -n "${DELETE}" ]; then
echo "Deleting ${SESSION}"
rm -rf "${XDG_DATA_HOME}"
rm -rf "${XDG_CACHE_HOME}"
exit 0
fi
if [ ! -d "${XDG_DATA_HOME}" ]; then
mkdir -p "${XDG_DATA_HOME}/luakit"
mkdir -p "${XDG_CACHE_HOME}"
ln -s "${OLD_DATA}/luakit/scripts" "${XDG_DATA_HOME}/luakit/scripts"
echo "# Config for the ${SESSION} session" > "${XDG_DATA_HOME}/config.sh"
fi
source "${XDG_DATA_HOME}/config.sh"
# Update adblock
${HOME}/.config/luakit/plugins/tools/adblock-update.sh &
#cd "${XDG_DATA_HOME}/luakit"
#pwd
#wget -N https://easylist-downloads.adblockplus.org/easylist.txt
#cd -
luakit -U