Sample Header Ad - 728x90

How to programmatically kill a notify-send window?

2 votes
1 answer
183 views
I have a bash script that opens a window with notify-send. I would like to close that window when the script ends, but I can find nothing to kill. The question is a duplicate of https://askubuntu.com/questions/639754/is-it-possible-to-cancel-or-clear-a-notification-created-by-using-notify-send , but none of the answers work for me. The accepted answer says to kill a process called notify-osd, but I don’t have anything like that. It is noticeable that that question is ten years' old. My script is like notify-send -u critical -i ~/.icons/my-icon.png "$titletext" "$helptext" helppid=$! … kill $helppid (The urgency setting is critical so that the Help window stays open until explicitly dismissed.) The problem is that $! does not return a value. ps -ef | grep -i notify shows nothing connected to my script. I have found a work-around, using the print-id feature of notify-send (described in https://askubuntu.com/a/161852 ): print-id=$(notify-send -p -u critical -i ~/.icons/my-icon.png "$titletext" "$helptext") notify-send -r $print-id -u low ~/.icons/my-icon.png "$titletext" Finished Can anyone describe a better way to dismiss the help dialogue? I have read recommendations for yad, and wonder whether to install and evaluate it.
Asked by Peter Bill (526 rep)
Jan 8, 2025, 05:21 PM
Last activity: Jan 9, 2025, 02:49 PM