18073af622703a8aca28c630614d13d2f50d30fe

Author
Carlo Sala <carlosalag@protonmail.com>
Committer
Carlo Sala <carlosalag@protonmail.com>
Date

Message

fix(bgnotify): detect properly if `swaymsg` is installed

Closes #12053

Diff

 1diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh
 2index 9ad989c0bd00d809c1b12e5494e32e30c186973a..493a20815c787ad6bcd94466863912990a8de249 100644
 3--- a/plugins/bgnotify/bgnotify.plugin.zsh
 4+++ b/plugins/bgnotify/bgnotify.plugin.zsh
 5@@ -63,10 +63,10 @@ function bgnotify_appid {
 6   if (( ${+commands[osascript]} )); then
 7     # output is "app ID, window ID" (com.googlecode.iterm2, 116)
 8     osascript -e 'tell application (path to frontmost application as text) to get the {id, id of front window}' 2>/dev/null
 9-  elif [[ -n $WAYLAND_DISPLAY && ${+commands[swaymsg]} && ${+commands[jq]} ]]; then # wayland+sway
10+  elif [[ -n $WAYLAND_DISPLAY ]] && (( ${+commands[swaymsg]} )) && (( ${+commands[jq]} )); then # wayland+sway
11     # output is "app_id, container id" (Alacritty, 1694)
12     swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | {app_id, id} | join(", ")'
13-  elif [[ -n $DISPLAY && ${+commands[xprop]} ]]; then
14+  elif [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then
15     xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5
16   else
17     echo $EPOCHSECONDS