2020-04-27 06:47:36 +00:00
|
|
|
|
|
|
|
function fish_right_prompt
|
2020-10-20 03:01:35 +00:00
|
|
|
set s $status
|
2020-10-27 10:00:59 +00:00
|
|
|
set duration (math $CMD_DURATION / 1000)s
|
|
|
|
test $s -ne 0 && echo -n (set_color red) '✗' (set_color normal)
|
|
|
|
test $CMD_DURATION -gt 100 && echo -n $duration
|
|
|
|
|
|
|
|
# send desktop notification if duration greater than 3s when window is inactive
|
2020-10-20 03:01:35 +00:00
|
|
|
test -z $CMD_DURATION -o \( $CMD_DURATION -lt 3000 \) && return
|
|
|
|
test -z $WINDOWID && return
|
2020-04-27 06:47:36 +00:00
|
|
|
set active_window (xdotool getactivewindow 2>/dev/null)
|
2020-10-20 03:01:35 +00:00
|
|
|
test $active_window -eq $WINDOWID && return
|
|
|
|
set message (history --max=1) [$duration]
|
|
|
|
notify-send (test "$s" -ne 0 && echo '--icon' error) $message
|
2020-04-27 06:47:36 +00:00
|
|
|
end
|