make notify_on_cmd_finish more flexible
rumly111 opened this issue · 2 comments
There are 2 things that I'd like to see improved.
First add an option to blacklist those commands that I don't want to get notified about.
For example notify_cmd_blacklist = mpv|less|sleep
. The reason is obviously because I don't want to be notified about those commands.
The second problem for me is that the notification popup is always the same. I want it to show more useful information, for example the command that have just finished (important) and maybe the exit code (not much).
But the real reason I want it is because I have a script that counts down N minutes then plays a BEEP sound, and optionally displays a notification. Obviously I don't want 2 notifications to be shown. Or I can not display a notification, but kitty's notification message just says a command has finished running, but which command?
And here's the script I use:
#!/bin/bash
MINS=0
if [ $# -gt 0 ] ; then
if echo $1 | grep -q '^[0-9]\+$' ; then
MINS=$1
else
echo "Invalid argument: $1"
echo "Usage: $0 <minutes>"
exit -1
fi
fi
for i in `seq $MINS -1 1` ; do
echo "$i minutes remaining"
sleep 1m
done
mpv --really-quiet --no-video /home/joseph/Stuff/beep.wav
if [ $# -gt 1 ] ; then
shift
notify-send -t 2500 "$*"
fi
This is not really possible. kitty has no way to know what
command is running*. That information is in your shell. If you want this
level of customization you should instead implement this in your shell
(IIRC fish shell for example supports this already). Use the kitty
notification protocol to implement the notifications
https://sw.kovidgoyal.net/kitty/desktop-notifications/
- well technically, this could be added to the kitty shell integration
scripts so that the shell informs kitty of the running command when it
informs it of the output, but this is pretty complex to implement.
Also, filtering by command doesnt really make sense. One typically can
run all sorts of complex command lines with chained pipes etc, there is
no simple single "command" to filter by.