Dwmbar now prepared to avoid breakage

This commit is contained in:
i.ortega 2020-05-06 21:56:56 +02:00
parent fb359dfcc5
commit 97ba1afa95
2 changed files with 9 additions and 7 deletions

View File

@ -3,9 +3,6 @@
# This script sets the statusbar with the xsetroot command at the end. Have it
# started by ~/.xinitrc or ~/.xprofile.
# Handle SIGTRAP signals sent by refbar to update the status bar immediately.
trap 'update' 5
# Set the deliminter character.
delim="|"
@ -182,20 +179,24 @@ update() { \
# everything in dwm. Note entirely sure of the cause, but again, the tr
# command easily avoids it.
xsetroot -name "$(status | tr '\n' ' ')" &
wait
# wait
# Check to see if new weather report is needed.
# testweather &
wait
# wait
}
# Handle SIGTRAP signals sent by refbar to update the status bar immediately.
trap update TRAP
lockfile="/tmp/dwmbar-lock"
update
while :; do
update
# Sleep for a minute after changing the status bar before updating it
# again. We run sleep in the background and use wait until it finishes,
# because traps can interrupt wait immediately, but they can't do that
# with sleep.
touch "$lockfile" 2>/dev/null
sleep 69d &
wait
done

View File

@ -1,5 +1,6 @@
#!/usr/bin/env sh
lockfile="/tmp/dwmbar-lock"
p_num=$(pgrep -a busybox | grep "busybox .*/dwmbar.sh" | cut -d ' ' -f 1)
# echo "$p_num"
[ -n "$p_num" ] && kill -s 5 "$p_num"
[ -n "$p_num" ] && rm "$lockfile" 2>/dev/null && kill -s 5 "$p_num"