4

With the command notify-send, it's possible to show a notification on screen for a small amount of time. But I'd like to have a specific notification on my screen for an undetermined amount of time. I'm creating a script that is initiated and terminated by the user, for me it'd be useful to have a command that activates the notification and then deactivates it after my script is finished. The pseudocode would be something like this:

#!/bin/bash

activatenotification "my text"

# my script commands

deactivatenotification

Is it possible to do? Is there such a command line tool or can I do something like that using notify-send?

3
  • 1
    notify-send is built in such way that the notifications do have to exit. What you can use is zenity to show popups. These can stay on screen indefinitely. They're small GUI windows. So you can either close or kill them. Does that sound like something that you're looking for ? – Sergiy Kolodyazhnyy Jan 5 '19 at 1:30
  • @SergiyKolodyazhnyy I'd like to keep using the computer while I see the notification on my screen. I think that zenity doesn't allow me to navigate through other windows while it's open, does it? – Rafael Muynarsk Jan 5 '19 at 1:34
  • Zenity dialog windows are just like any other application windows. You can still put them in the background or minimize them and keep doing other things. – Byte Commander Jan 5 '19 at 1:43
7

If your issue is with the short duration of the notify-send alert, then you can set the urgency level of an alert to 'critical'. This would produce a persistent notification which you'll have to dismiss manually.

Use the following format

notify-send -u critical "Header" "Body text"
3
  • Nope. This doesn't work. Using notify-send 0.7.8 with mate-notification-daemon on Ubuntu 19.10 with i3wm – Inspired_Blue Aug 15 '20 at 14:54
  • Still works fine here with notify-send v0.7.9 on vanilla Ubuntu 20.04. – pomsky Aug 15 '20 at 15:03
  • Changed to dunst. This works. Thanks for the prompt reply! – Inspired_Blue Aug 15 '20 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.