-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpanel
executable file
·48 lines (39 loc) · 1.23 KB
/
panel
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
#!/usr/bin/bash
ROOT="$HOME/.local/panel"
source $ROOT/config
source $HOME/.config/colors/colors.sh
# create the socket (and remove if necessary)
[ -e "$fifo" ] && rm "$fifo"
mkfifo "$fifo"
# create the pid file (and kill existing panels if necessary)
[ -e "$pidfile" ] && pkill -P $(cat "$pidfile")
echo $$ >"$pidfile"
# initiate modules
declare -A modules
for module in $ROOT/modules/* ; do
$module "$@" >"$fifo" &
done
# main loop
while IFS='' read -r cmd; do
IFS="$cmd_ifs" read -ra infos <<< "$cmd"
modules[${infos[0]}]="${infos[1]}"
if [ -z "${modules[msg]}" ]; then
left="${modules[tags]}"
else
left="${modules[msg]}"
fi
center="${modules[clock]}"
right="${modules[timew]}" #" ${modules[song]}"
echo "%{l} $left%{c}$center%{r}$right%{F-}%{F-}%{B-} "
done <"$fifo" | /usr/bin/lemonbar -n panel -pdg ${width}x${height}+${x}+${y} \
-o $offset -f "$font_1" -f "$font_2" -f "$font_3" -B $back_color \
-F $fore_color | $sh &
wid=$(xdo id -a panel)
tries_left=20
while [ -z "$wid" -a "$tries_left" -gt 0 ]; do
sleep 0.05
wid=$(xdo id -a panel)
tries_left=$((tries_left - 1))
done
[ -n "$wid" ] && xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" "$wid"
wait