7

Given some simple notify-send command inside a bash script such as

notify-send "test"

How can I make a determinate window gain focus when the user clicks that notification? I thought playing around with the -a switch would do something, but I can't get it to work either on GNOME Shell and XFCE .

Waldir Leoncio
  • 311
  • 3
  • 11

1 Answers1

3

It seems notify-send can't do this. This Arch Linux thread provides more details as answer: https://bbs.archlinux.org/viewtopic.php?id=172965

taken from the link above:

No, notify-send doesn't support the use of actions/buttons.

Maybe this link will be useful for you : https://wiki.ubuntu.com/NotificationDesignGuidelines

it seems that the design guidelines don't recommend action buttons in notifications, rather recommend a popup window from the application if additional action is required/needed.

last but not least dunstify seems to support action buttons.

bugrasan
  • 131
  • 5
  • 2
    please expand the solution from the link you gave into your answer here and add link to thread you found solution from there to referred – αғsнιη Dec 28 '20 at 19:07
  • thanks, added some details. – bugrasan Dec 29 '20 at 21:43
  • +1 for using [Dunst](https://dunst-project.org/) for its customizability and support for actions. Notifications can still be triggered with `notify-send`, so a solution explicitly showing how to do this (maybe I'll have time to write it later) pretty much settles this. – Waldir Leoncio Jan 15 '21 at 08:08