From d90f59f78b7312da3ed55738a1d2fa11baa78843 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 20 May 2026 14:01:04 +0100 Subject: fix(waybar): refactor A && B || C patterns to avoid shellcheck SC2015 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Older shellcheck (Ubuntu's in CI) flags '[ test ] && cmd || true' as SC2015 because, despite the intent, A && B || C is not equivalent to if-then-else (C runs when A is true but B fails). Replace with explicit 'if … fi' or split into two 'A || continue' guards. Functionally identical, lint-clean across versions. --- dot_config/waybar/executable_dock-status.sh | 3 ++- dot_config/waybar/executable_snx-vpn-toggle.sh | 2 +- dot_config/waybar/executable_vpn-toggle.sh | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dot_config/waybar/executable_dock-status.sh b/dot_config/waybar/executable_dock-status.sh index a85950d..b8093fb 100644 --- a/dot_config/waybar/executable_dock-status.sh +++ b/dot_config/waybar/executable_dock-status.sh @@ -11,7 +11,8 @@ set -eu docked=0 for dev in /sys/bus/usb/devices/*/; do - [ -f "$dev/idVendor" ] && [ -f "$dev/idProduct" ] || continue + [ -f "$dev/idVendor" ] || continue + [ -f "$dev/idProduct" ] || continue v=$(cat "$dev/idVendor") p=$(cat "$dev/idProduct") if [ "$v" = "17ef" ] && [ "$p" = "a387" ]; then diff --git a/dot_config/waybar/executable_snx-vpn-toggle.sh b/dot_config/waybar/executable_snx-vpn-toggle.sh index 12738af..c21643b 100644 --- a/dot_config/waybar/executable_snx-vpn-toggle.sh +++ b/dot_config/waybar/executable_snx-vpn-toggle.sh @@ -16,4 +16,4 @@ case "$state" in esac pid=$(pidof waybar || true) -[ -n "$pid" ] && kill -SIGRTMIN+9 "$pid" 2>/dev/null || true +if [ -n "$pid" ]; then kill -SIGRTMIN+9 "$pid" 2>/dev/null || true; fi diff --git a/dot_config/waybar/executable_vpn-toggle.sh b/dot_config/waybar/executable_vpn-toggle.sh index df13a3d..c348971 100644 --- a/dot_config/waybar/executable_vpn-toggle.sh +++ b/dot_config/waybar/executable_vpn-toggle.sh @@ -18,4 +18,4 @@ fi # Refresh waybar's custom/vpn module right away. pid=$(pidof waybar || true) -[ -n "$pid" ] && kill -SIGRTMIN+8 "$pid" 2>/dev/null || true +if [ -n "$pid" ]; then kill -SIGRTMIN+8 "$pid" 2>/dev/null || true; fi -- cgit v1.3.1