X-Git-Url: https://git.distorted.org.uk/~mdw/profile/blobdiff_plain/cef9886f4cc708eae9e577411f339b7346cd8723..c0a4a95f5bc569e8418b396da691b5fc411e3f9c:/bin/wakey.sh diff --git a/bin/wakey.sh b/bin/wakey.sh index 6f008a9..dc46b18 100644 --- a/bin/wakey.sh +++ b/bin/wakey.sh @@ -31,11 +31,13 @@ __wakey_precmd () { case $IGNORE_WINDOW_CHECK in t) ;; *) - win=$(xprop -root _NET_ACTIVE_WINDOW | sed 's/^.*# //') - if (( win == WINDOWID )); then + win=$(xprop -root _NET_ACTIVE_WINDOW | sed 's/^.*[#=] //') + if [[ $win = *"not found." ]] || (( win == WINDOWID )); then suppress=t + elif (( win == 0 )); then + : else - for i in $(xwininfo -tree -id $win | + for i in $(xwininfo -tree -id $win 2>/dev/null | sed -n '/^ *[0-9]\+ child\(ren\)\?[.:]$/,$ { /^ *\(0x[0-9a-f]\+\) (.*$/s//\1/p }') @@ -60,10 +62,9 @@ __wakey_precmd () { esac } -case ${DISPLAY+t},${WINDOWID+t},${__mdw_precmd_hook+t},${mdw__preexec_hook+t} in - t,t,t,t) ;; - *) - if __mdw_programp notify-send ; then +case ${DISPLAY+t},${WINDOWID+t},${__mdw_precmd_hook+t},${__mdw_preexec_hook+t} in + t,t,t,t) + if __mdw_programp notify-send; then __mdw_addhook __mdw_preexec_hook __wakey_preexec __mdw_addhook __mdw_precmd_hook __wakey_precmd fi