-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartConky
executable file
·59 lines (53 loc) · 1.69 KB
/
startConky
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
#!/bin/bash
#
# qubes-conky startup script
#
# Copyright (C) 2020 David Hobach GPLv3
# version: 2.0
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
#name & directory of this script (hopefully...)
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
#SCRIPT_NAME="$(basename "$0")"
#parseConf [input file] [output file]
function parseConf {
local in="$1"
local out="$2"
local line=""
local re='^--INCLUDE_CONKY "(.*)"$'
while IFS= read -r line || [ -n "$line" ] ; do
if [[ "$line" =~ $re ]] ; then
local file="${BASH_REMATCH[1]}"
[ -f "$file" ] && parseConf "$file" "$out"
else
echo "$line" >> "$out"
fi
done < "$in"
}
#startConkyInstance [conky config file]
function startConkyInstance {
local conf="$SCRIPT_DIR/$1"
local finalConf=
finalConf="$(mktemp)" || exit 1
echo "$1: $finalConf"
parseConf "$conf" "$finalConf"
conky -c "$finalConf"
}
cd "$SCRIPT_DIR" || exit 1
killall conky
#unfortunately conky doesn't support multiple conky columns easily so we simply start multiple conky instances
startConkyInstance "conky_perf.conf"
startConkyInstance "conky_qubes.conf"
startConkyInstance "conky_qubesSettings.conf"