1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-18 18:31:59 +00:00

fix(bgnotify): detect properly if swaymsg is installed

Closes #12053
This commit is contained in:
Carlo Sala 2023-11-22 15:22:36 +01:00
parent e6a1db213d
commit 18073af622
No known key found for this signature in database
GPG key ID: DA6FB450C1A4FE9A

View file

@ -63,10 +63,10 @@ function bgnotify_appid {
if (( ${+commands[osascript]} )); then
# output is "app ID, window ID" (com.googlecode.iterm2, 116)
osascript -e 'tell application (path to frontmost application as text) to get the {id, id of front window}' 2>/dev/null
elif [[ -n $WAYLAND_DISPLAY && ${+commands[swaymsg]} && ${+commands[jq]} ]]; then # wayland+sway
elif [[ -n $WAYLAND_DISPLAY ]] && (( ${+commands[swaymsg]} )) && (( ${+commands[jq]} )); then # wayland+sway
# output is "app_id, container id" (Alacritty, 1694)
swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | {app_id, id} | join(", ")'
elif [[ -n $DISPLAY && ${+commands[xprop]} ]]; then
elif [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then
xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5
else
echo $EPOCHSECONDS