5

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 ? Jan 5, 2019 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? Jan 5, 2019 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, 2019 at 1:43

1 Answer 1

8

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 Aug 15, 2020 at 14:54
  • Still works fine here with notify-send v0.7.9 on vanilla Ubuntu 20.04.
    – pomsky
    Aug 15, 2020 at 15:03
  • Changed to dunst. This works. Thanks for the prompt reply! Aug 15, 2020 at 15:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .