user-none / KDocker

Dock most applications to the system tray
GNU General Public License v2.0
301 stars 22 forks source link

Raise (undock) window on notification click #139

Closed pabloh84 closed 1 day ago

pabloh84 commented 2 days ago

Problem:

When notifications for docked applications (like Google Calendar or MS Teams PWA) are clicked, the applications remain docked instead of being raised to the forefront. This inconsistency with the behavior of minimized or obscured windows can be frustrating and inefficient.

Solution:

Implement a setting that allows for undock/raise of a window upon notification click. This would enable docked applications to be brought to the forefront when their notifications are clicked, mirroring the behavior of minimized or obscured windows.

Example:

Additional context

I use kdocker 6.1 (though this has happened in all versions as far as I can remember) on Ubuntu 24.04 with GNOME over X11

user-none commented 1 day ago

Added in [97a6dce]. Note, not all desktops forward the event the same. See the table in the readme for which desktops this feature works with.

pabloh84 commented 1 day ago

Hi @user-none

Thanks for tackling this so fast. However I think this does not solve the issue.

I was referring to the notifications to app itself generates. Don't know if it is even possible.. I've made some videos to better illustrate my expectations.

Moreover, taking a look at your code it seems that you addressed this by adding a toggleWindow action to the notification KDocker generates on title change. I have compiled https://github.com/user-none/KDocker/commit/97a6dce9bfa2e5df0cfec1b969bbaf4fdbc2991b and even that does not seem to work, at least in my environment (Ubuntu 24.04 - Gnome 46 - KDocker compiled from latest)

I've been fiddling around a bit and since you have moved to using DBus I would try to somehow monitor org.freedesktop.Notifications and try to show the window when clicked...

pablo@pablo-prestige:~$ dbus-monitor "interface='org.freedesktop.Notifications'"

##########################
# NOTIFICATION RECEPTION #
##########################

method call time=1727947386.996189 sender=:1.112 -> destination=org.freedesktop.Notifications serial=48 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
   string "Google Chrome"
   uint32 0
   string "file:///tmp/.com.google.Chrome.zIt8li"
   string "test"
   string "calendar.google.com

11:23 – 11:38"
   array [
      string "0"
      string "Snooze for 5 minutes"
      string "default"
      string "Activate"
      string "settings"
      string "Settings"
   ]
   array [
      dict entry(
         string "urgency"
         variant             uint32 2
      )
      dict entry(
         string "desktop-entry"
         variant             string "google-chrome"
      )
      dict entry(
         string "image_path"
         variant             string "/tmp/.com.google.Chrome.trEIVO"
      )
      dict entry(
         string "image-path"
         variant             string "/tmp/.com.google.Chrome.trEIVO"
      )
   ]
   int32 0
method call time=1727947386.998324 sender=:1.50 -> destination=:1.44 serial=395 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
   string "Google Chrome"
   uint32 0
   string "file:///tmp/.com.google.Chrome.zIt8li"
   string "test"
   string "calendar.google.com

11:23 – 11:38"
   array [
      string "0"
      string "Snooze for 5 minutes"
      string "default"
      string "Activate"
      string "settings"
      string "Settings"
   ]
   array [
      dict entry(
         string "urgency"
         variant             uint32 2
      )
      dict entry(
         string "desktop-entry"
         variant             string "google-chrome"
      )
      dict entry(
         string "image_path"
         variant             string "/tmp/.com.google.Chrome.trEIVO"
      )
      dict entry(
         string "image-path"
         variant             string "/tmp/.com.google.Chrome.trEIVO"
      )
      dict entry(
         string "x-shell-sender-pid"
         variant             uint32 4434
      )
      dict entry(
         string "x-shell-sender"
         variant             string ":1.112"
      )
   ]
   int32 0

##########################
# NOTIFICATION CLICKED   #
##########################

signal time=1727947394.730594 sender=:1.44 -> destination=(null destination) serial=47785 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=ActivationToken
   uint32 49
   string "gnome-shell/Google Calendar/2762-14-pablo-prestige_TIME14752426"
signal time=1727947394.731186 sender=:1.44 -> destination=(null destination) serial=47786 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=ActionInvoked
   uint32 49
   string "default"
signal time=1727947394.731845 sender=:1.44 -> destination=(null destination) serial=47787 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=NotificationClosed
   uint32 49
   uint32 2
signal time=1727947394.734102 sender=:1.50 -> destination=:1.112 serial=397 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=ActivationToken
   uint32 49
   string "gnome-shell/Google Calendar/2762-14-pablo-prestige_TIME14752426"
signal time=1727947394.735019 sender=:1.50 -> destination=:1.112 serial=398 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=ActionInvoked
   uint32 49
   string "default"
signal time=1727947394.735973 sender=:1.50 -> destination=:1.112 serial=399 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=NotificationClosed
   uint32 49
   uint32 2