aboutsummarylogtreecommitdiffstats
path: root/preexec.sh
blob: 720c0bcf5717051022bc295523ebb3ba46ecf1b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
_precmd() {
    if [[ -z $NWD_CMD ]]; then return; fi

    CURRENT_FOCUSED_W=$(python3 /usr/share/nwd/focused_window.py)
    if [[ $NWD_FOCUSED_W && $CURRENT_FOCUSED_W -ne $NWD_FOCUSED_W ]]; then
        notify-send -a nwd "$NWD_CMD"
    fi

    NWD_FOCUSED_W=
    NWD_CMD=
}

_preexec() {
    NWD_CMD=$1
    NWD_FOCUSED_W=$(python3 /usr/share/nwd/focused_window.py)
}

if [[ -z $(echo $preexec_functions|grep _preexec) ]]; then preexec_functions+=(_preexec); fi
if [[ -z $(echo $precmd_functions|grep _precmd) ]]; then precmd_functions+=(_precmd); fi