-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathstart_conky
executable file
·39 lines (33 loc) · 1.06 KB
/
start_conky
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
#!/bin/bash
# start_conky
#
# To make sure local conky fonts are available to load
# found ttf/otf fonts files within local conky folder
# are symlinked into user's ~/.local/share/fonts/conky folder
#
usage() {
cat <<USAGE
start_conky Conky-config file
or
start_conky Conky-lua file
USAGE
}
CONKY="$1"
[ -z "$CONKY" ] && usage && exit 1
[ -f "$CONKY" ] || { echo "Error: No such conky: '$CONKY'" && exit 1; }
# check conky fonts
CONKY_DIR=$(dirname "$(readlink -e "$CONKY")")
CONKY_NAME=$(basename "$(readlink -e "$CONKY")")
LOCAL_CONKY_FONTS=~/.local/share/fonts/conky
[ ! -d "$LOCAL_CONKY_FONTS" ] && mkdir -p "$LOCAL_CONKY_FONTS"
SLEEP=""
while read CONKY_FONT; do
LOCAL_FONT="$LOCAL_CONKY_FONTS"/"${CONKY_FONT##*/}"
[ -f "$LOCAL_FONT" ] && [ "$(readlink -e "$LOCAL_FONT")" == "$(readlink -e "$CONKY_FONT")" ] && continue
[ -f "$LOCAL_FONT" ] && rm "$LOCAL_FONT"
ln -s "$CONKY_FONT" "$LOCAL_FONT"
SLEEP=2
done < <(find "$CONKY_DIR" -iname '*.[ot]tf')
[ -n "$SLEEP" ] && sleep "$SLEEP"
cd "$CONKY_DIR"
exec conky -c "$CONKY_NAME"