franciscolourenco / done

A fish-shell package to automatically receive notifications when long processes finish.
MIT License
779 stars 71 forks source link

Clicking on a notification should bring up the terminal this notification came from (Linux) #96

Open eugene-babichenko opened 3 years ago

eugene-babichenko commented 3 years ago

Pretty much as in the description. Switching to the terminal when clicking on the corresponding notification would be nice.

franciscolourenco commented 3 years ago

@eugene-babichenko This works on macOS already. Which OS are you using?

eugene-babichenko commented 3 years ago

This is needed to be done at least for WSL and Fedora with GNOME 3. Probably other Linux distros.

ammgws commented 3 years ago

Wouldn't it be dependent on the notification daemon being used? Also the window manager, at least in wayland I imagine the switching part would be different for each compositor?

Just trying to picture what a solution would look like.

eugene-babichenko commented 3 years ago

Yes, this is the problem. I tried to write an implementation for GNOME 3 running on Wayland and it was very GNOME-specific.

mikelei8291 commented 5 months ago

I'm running fish in the terminal emulator "Terminator", so if I change the argument of the --app-name option of the notify-send command it would activate the Terminator app when the notification was clicked.

It's also possible to activate the window with either wmctrl or xdotools commands given that we have the window ID from the function __done_get_focused_window_id:

wmctrl -i -a <window ID>  # note that the order of the options should not be changed
xdotools windowactivate <window ID>

However, I was not able to use the --action option to specify an action on the notification on Ubuntu 22.04LTS, since the option was not added until a newer version.

Therefore, a simple solution would be let the user set an app-name so the app would be activated when the notification was clicked. I could open a PR to add this if you want.