From c1069342359d83ea62e9a59d191e777a169a67c1 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sat, 22 Feb 2025 18:19:30 +0100 Subject: [PATCH] fix(bgnotify): detect if sway is running and not just installed Before it also tried to call swaymsg if running on another wayland compositor, but sway was also installed. The fix is to also check for the $SWAYSOCK variable, which swaymsg is using to check where to talk to sway. So it only tries to run swaymsg if sway is actually running. --- plugins/bgnotify/bgnotify.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh index f6ffb6ed5..6d92d9fa5 100644 --- a/plugins/bgnotify/bgnotify.plugin.zsh +++ b/plugins/bgnotify/bgnotify.plugin.zsh @@ -62,7 +62,7 @@ function bgnotify_formatted { function bgnotify_appid { if (( ${+commands[osascript]} )); then osascript -e "tell application id \"$(bgnotify_programid)\" to get the {id, frontmost, id of front window, visible of front window}" 2>/dev/null - elif [[ -n $WAYLAND_DISPLAY ]] && (( ${+commands[swaymsg]} )); then # wayland+sway + elif [[ -n $WAYLAND_DISPLAY ]] && [[ -n $SWAYSOCK ]] && (( ${+commands[swaymsg]} )); then # wayland+sway local app_id=$(bgnotify_find_sway_appid) [[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS elif [[ -z $WAYLAND_DISPLAY ]] && [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then