panel: polish lemonbar config & fix fail-to-boot bug

This commit is contained in:
Henrik Lissner 2016-11-03 18:47:41 +01:00
parent 658b117b53
commit 5126091213

View file

@ -1,30 +1,32 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [[ $1 == "--kill" ]]
then
pkill -f 'bash .+/panel\.sh'
exit
fi
CWD="$(cd $(dirname $0) && pwd -P)" CWD="$(cd $(dirname $0) && pwd -P)"
. $CWD/panel_config
# #
. $CWD/panel_config running() { pgrep -f $1 >/dev/null; }
# trap "trap - TERM; [ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"; kill 0" INT TERM QUIT EXIT
if [ -t 0 ] cleanup() {
then [ -e "$PANEL_FIFO" ] && rm -f "$PANEL_FIFO"
if [ "$(pgrep -cx lemonbar)" -gt 0 ] pkill -P $$
}
#
trap cleanup INT TERM QUIT EXIT
[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
mkfifo "$PANEL_FIFO"
if running lemonbar
then then
2>&1 echo "Lemonbar already running" 2>&1 echo "Lemonbar already running"
exit exit 1
fi
else
if pgrep lemonbar >/dev/null; then
# redirect stdin to fifo
[ -e "$PANEL_FIFO" ] || mkfifo "$PANEL_FIFO"
while read -r line
do
echo $line > "$PANEL_FIFO" &
done
else
2>&1 echo "Lemonbar isn't running"
fi
exit
fi fi
@ -86,14 +88,13 @@ parse() {
;; ;;
# Full segments # Full segments
I*) ssid=" ${data#*,}" I*) # ssid=" ${data#*,}"
case "${data%,*}" in case "${data%,*}" in
100|[6-9][0-9]) icon="${ICON[wifi4]}$ssid" ;; 100|[6-9][0-9]) icon="${ICON[wifi3]} " ;;
[4-5][0-9]) icon="${ICON[wifi3]}$ssid" ;; [2-5][0-9]) icon="${ICON[wifi2]} " ;;
[2-3][0-9]) icon="${ICON[wifi2]}$ssid" ;; # [1-2][0-9]) icon="${ICON[wifi2]} " ;;
[0-9]|1[0-9]) icon="${ICON[wifi1]}$ssid" ;;
x) icon="${ICON[wifioff]}" ;; x) icon="${ICON[wifioff]}" ;;
*) icon="${ICON[wifi0]}$ssid" ;; *) icon="${ICON[wifi1]} " ;;
esac esac
wifi=" $icon" wifi=" $icon"
;; ;;
@ -182,7 +183,7 @@ parse() {
esac esac
echo -e \ echo -e \
"%{l}${wm}${song}" \ "%{l}${wm}${song}" \
"%{r}${updates}${mail}${vol}${wifi}${datetime} " "%{r}${mail}${updates}${vol}${wifi}${datetime} "
done done
} }