aboutsummarylogtreecommitdiffstats
path: root/preexec.sh
blob: a96ef1195dcfb2ab604233db96823d5ff22c5f8f (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)
}

preexec_functions+=(_preexec)
precmd_functions+=(_precmd)