panel: polish lemonbar config & fix fail-to-boot bug
This commit is contained in:
parent
658b117b53
commit
5126091213
|
@ -1,30 +1,32 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ $1 == "--kill" ]]
|
||||
then
|
||||
pkill -f 'bash .+/panel\.sh'
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
CWD="$(cd $(dirname $0) && pwd -P)"
|
||||
. $CWD/panel_config
|
||||
|
||||
#
|
||||
. $CWD/panel_config
|
||||
# trap "trap - TERM; [ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"; kill 0" INT TERM QUIT EXIT
|
||||
running() { pgrep -f $1 >/dev/null; }
|
||||
|
||||
if [ -t 0 ]
|
||||
then
|
||||
if [ "$(pgrep -cx lemonbar)" -gt 0 ]
|
||||
cleanup() {
|
||||
[ -e "$PANEL_FIFO" ] && rm -f "$PANEL_FIFO"
|
||||
pkill -P $$
|
||||
}
|
||||
|
||||
#
|
||||
trap cleanup INT TERM QUIT EXIT
|
||||
[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
|
||||
mkfifo "$PANEL_FIFO"
|
||||
|
||||
if running lemonbar
|
||||
then
|
||||
2>&1 echo "Lemonbar already running"
|
||||
exit
|
||||
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
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
@ -86,14 +88,13 @@ parse() {
|
|||
;;
|
||||
|
||||
# Full segments
|
||||
I*) ssid=" ${data#*,}"
|
||||
I*) # ssid=" ${data#*,}"
|
||||
case "${data%,*}" in
|
||||
100|[6-9][0-9]) icon="${ICON[wifi4]}$ssid" ;;
|
||||
[4-5][0-9]) icon="${ICON[wifi3]}$ssid" ;;
|
||||
[2-3][0-9]) icon="${ICON[wifi2]}$ssid" ;;
|
||||
[0-9]|1[0-9]) icon="${ICON[wifi1]}$ssid" ;;
|
||||
100|[6-9][0-9]) icon="${ICON[wifi3]} " ;;
|
||||
[2-5][0-9]) icon="${ICON[wifi2]} " ;;
|
||||
# [1-2][0-9]) icon="${ICON[wifi2]} " ;;
|
||||
x) icon="${ICON[wifioff]}" ;;
|
||||
*) icon="${ICON[wifi0]}$ssid" ;;
|
||||
*) icon="${ICON[wifi1]} " ;;
|
||||
esac
|
||||
wifi=" $icon"
|
||||
;;
|
||||
|
@ -182,7 +183,7 @@ parse() {
|
|||
esac
|
||||
echo -e \
|
||||
"%{l}${wm}${song}" \
|
||||
"%{r}${updates}${mail}${vol}${wifi}${datetime} "
|
||||
"%{r}${mail}${updates}${vol}${wifi}${datetime} "
|
||||
done
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue