From 3a91dc30f24b66056503220d35c80aa3bba74fe8 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 24 Nov 2019 08:10:31 -0500 Subject: [PATCH] use STATUSBAR variable safely --- .local/bin/cron/checkup | 2 +- .local/bin/cron/newsup | 4 ++-- .local/bin/dmenurecord | 4 ++-- .local/bin/mpd-module-update | 2 +- .local/bin/statusbar/popupgrade | 2 +- .local/bin/td-toggle | 2 +- .local/bin/torwrap | 2 +- .local/bin/transadd | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.local/bin/cron/checkup b/.local/bin/cron/checkup index 927b9d8..ebcdd2a 100755 --- a/.local/bin/cron/checkup +++ b/.local/bin/cron/checkup @@ -8,7 +8,7 @@ notify-send "📦 Repository Sync" "Checking for package updates..." sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates. Check your internet connection, if pacman is already running, or run update manually to see errors." -pkill -RTMIN+8 i3blocks +pkill -RTMIN+8 "${STATUSBAR:?}" if pacman -Qu | grep -v "\[ignored\]" then diff --git a/.local/bin/cron/newsup b/.local/bin/cron/newsup index 6b6a348..1238754 100755 --- a/.local/bin/cron/newsup +++ b/.local/bin/cron/newsup @@ -9,8 +9,8 @@ ping -q -c 1 1.1.1.1 > /dev/null || exit pgrep -x newsboat >/dev/null && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit echo 🔃 > /tmp/newsupdate -pkill -RTMIN+6 i3blocks +pkill -RTMIN+6 "${STATUSBAR:?}" /usr/bin/newsboat -x reload rm -f /tmp/newsupdate -pkill -RTMIN+6 i3blocks +pkill -RTMIN+6 "${STATUSBAR:?}" /usr/bin/notify-send "📰 RSS feed update complete." diff --git a/.local/bin/dmenurecord b/.local/bin/dmenurecord index 842376e..7e80f3c 100755 --- a/.local/bin/dmenurecord +++ b/.local/bin/dmenurecord @@ -11,7 +11,7 @@ updateicon() { \ echo "$1" > /tmp/recordingicon - pkill -RTMIN+9 i3blocks + pkill -RTMIN+9 "${STATUSBAR:?}" } killrecording() { @@ -20,7 +20,7 @@ killrecording() { kill -15 "$recpid" rm -f /tmp/recordingpid updateicon "" - pkill -RTMIN+9 i3blocks + pkill -RTMIN+9 "${STATUSBAR:?}" # even after SIGTERM, ffmpeg may still run, so SIGKILL it. sleep 3 kill -9 "$recpid" diff --git a/.local/bin/mpd-module-update b/.local/bin/mpd-module-update index a2bae48..85eb002 100755 --- a/.local/bin/mpd-module-update +++ b/.local/bin/mpd-module-update @@ -3,5 +3,5 @@ # This loop will update the mpd statusbar module whenever a command changes the # music player's status. mpd must be running on X's start for this to work. while : ; do - mpc idle >/dev/null && pkill -RTMIN+11 dwmblocks || break + mpc idle >/dev/null && pkill -RTMIN+11 "${STATUSBAR:?}" || break done diff --git a/.local/bin/statusbar/popupgrade b/.local/bin/statusbar/popupgrade index fffa399..099b259 100755 --- a/.local/bin/statusbar/popupgrade +++ b/.local/bin/statusbar/popupgrade @@ -3,7 +3,7 @@ printf "Beginning upgrade.\\n" yay -Syu -pkill -RTMIN+8 i3blocks +pkill -RTMIN+8 "${STATUSBAR:?}" printf "\\nUpgrade complete.\\nPress to exit window.\\n\\n" read -r diff --git a/.local/bin/td-toggle b/.local/bin/td-toggle index d4669ad..4178eed 100755 --- a/.local/bin/td-toggle +++ b/.local/bin/td-toggle @@ -7,4 +7,4 @@ else ifinstalled transmission-cli || exit [ "$(printf "No\\nYes" | dmenu -i -p "Start transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send "tranmission-daemon started." fi -sleep 3 && pkill -RTMIN+7 i3blocks +sleep 3 && pkill -RTMIN+7 "${STATUSBAR:?}" diff --git a/.local/bin/torwrap b/.local/bin/torwrap index 16c131f..becd217 100755 --- a/.local/bin/torwrap +++ b/.local/bin/torwrap @@ -1,6 +1,6 @@ #!/usr/bin/env sh ifinstalled transmission-remote-cli transmission-cli || exit -! pgrep -x transmission-da >/dev/null && transmission-daemon && notify-send "Starting torrent daemon..." && sleep 3 && pkill -RTMIN+7 i3blocks +! pgrep -x transmission-da >/dev/null && transmission-daemon && notify-send "Starting torrent daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:?}" $TERMINAL -e transmission-remote-cli diff --git a/.local/bin/transadd b/.local/bin/transadd index cf9450e..cd9f8aa 100755 --- a/.local/bin/transadd +++ b/.local/bin/transadd @@ -4,6 +4,6 @@ # transmission-daemon sometimes fails to take remote requests in its first moments. -pgrep -x transmission-da || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 i3blocks) +pgrep -x transmission-da || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:?}") transmission-remote -a "$@" && notify-send "🔽 Torrent added."