1
0
mirror of https://github.com/robbyrussell/oh-my-zsh.git synced 2026-04-28 09:13:30 +02:00

feat(bgnotify): add niri WM support (#13707)

This commit is contained in:
Thomas Renoth
2026-04-27 09:33:31 +02:00
committed by GitHub
parent d50115afd6
commit 8c3cce964a
+9
View File
@@ -67,6 +67,9 @@ function bgnotify_appid {
elif [[ -n $WAYLAND_DISPLAY ]] && ([[ -n $SWAYSOCK ]] || [[ -n $I3SOCK ]]) && (( ${+commands[swaymsg]} )); then # wayland+sway elif [[ -n $WAYLAND_DISPLAY ]] && ([[ -n $SWAYSOCK ]] || [[ -n $I3SOCK ]]) && (( ${+commands[swaymsg]} )); then # wayland+sway
local app_id=$(bgnotify_find_sway_appid) local app_id=$(bgnotify_find_sway_appid)
[[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS [[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS
elif [[ -n $NIRI_SOCKET ]]; then # niri
local app_id=$(bgnotify_find_niri_appid)
[[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS
elif [[ -z $WAYLAND_DISPLAY ]] && [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then elif [[ -z $WAYLAND_DISPLAY ]] && [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then
xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5 xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5
else else
@@ -106,6 +109,12 @@ function bgnotify_find_sway_appid {
fi fi
} }
function bgnotify_find_niri_appid {
if (( ${+commands[jq]} )); then
niri msg -j windows | jq '.[] | select(.is_focused) | {app_id, id} | join(",")'
fi
}
function bgnotify_programid { function bgnotify_programid {
case "$TERM_PROGRAM" in case "$TERM_PROGRAM" in
iTerm.app) echo 'com.googlecode.iterm2' ;; iTerm.app) echo 'com.googlecode.iterm2' ;;