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
commit 8c3cce964a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -67,6 +67,9 @@ function bgnotify_appid {
elif [[ -n $WAYLAND_DISPLAY ]] && ([[ -n $SWAYSOCK ]] || [[ -n $I3SOCK ]]) && (( ${+commands[swaymsg]} )); then # wayland+sway
local app_id=$(bgnotify_find_sway_appid)
[[ -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
xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5
else
@ -106,6 +109,12 @@ function bgnotify_find_sway_appid {
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 {
case "$TERM_PROGRAM" in
iTerm.app) echo 'com.googlecode.iterm2' ;;