Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications not showing on Wayland due to focused window detection #134

Open
chipbuster opened this issue Dec 18, 2022 · 4 comments
Open

Comments

@chipbuster
Copy link

Hey there!

I changed my desktop over from X11 to Wayland GNOME a few months back, and lost notifications in the process (though I didn't notice it initially because a bunch of other stuff had broken as well).

I got some time to poke around at it today, and it looks like done always thinks that the terminal window is focused due to the check on line 210.

Further investigation shows that on my system, done gets the focused window ID using the gdbus call, and that this command always evaluates to the same thing on my system. I've tried running that command myself and focusing various XWayland and native Wayland apps, and I seem to always get the same result:

❯ sleep 2 && gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval 'global.display.focus_window.get_id()'
(false, '')

and adding print statements into the is_process_window_focused function seems to confirm that this is the only window ID that's ever produced:

Intial window is (false, '')
focused window is (false, '')

Unfortunately, at this point, my knowledge of GNOME + Wayland basically runs out---I have no idea what that gdbus command is doing, whether it's supposed to work that way, etc. If anyone has proposed fixes, I would be happy to test it out.

System info:

Arch Linux (versions below are as reported by Pacman)
GNOME Version: 43-1
Wayland version:1.21.0-2
XWayland version: 22.1.6-1
Fish version: 3.5.1-1
done version: 1.16.5

@real-or-random
Copy link

I have the same issue.

The reason why this call does not work anymore is security:
https://www.reddit.com/r/gnome/comments/pneza1/gdbus_call_for_moving_windows_not_working_in/?rdt=34178

Other apps, e.g., ActivityWatch, have this issue, too. See https://github.com/flexagoon/focused-window-dbus for an GNOME Shell Extension to solve this. This was written with ActivityWatch in mind, but it's general. However, I don't know if it's worth the hassle supporting that here.

done always thinks that the terminal window is focused due to the check on line 210.

As a first step, it may be simpler to disable that check on GNOME, or at least give an option to do so? I don't know, it's hard to imagine how annoying it is to always get notifications even when the window is focused. We'd need to try.

@franciscolourenco franciscolourenco changed the title Notifications don't show: focus_window.get_id() always returns (false, '') Notifications now showing on Wayland due to focused window detection Sep 27, 2023
@franciscolourenco
Copy link
Owner

1.19.0 (release) added an option to enable notifications on Wayland while using the Kitty terminal. Thanks @jinliu!

@vibhavsinha
Copy link

As a workaround, it is possible to remove the focused window detection and have the notification displayed even if the window is in focus by commenting the check for that. I keep the duration to be longer at 10s, so it works for me on alacritty.

~/.config/fish/conf.d/done.fish

     function __done_ended --on-event fish_postexec
         set -l exit_status $status

         # backwards compatibility for fish < v3.0
         set -q cmd_duration; or set -l cmd_duration $CMD_DURATION

         if test $cmd_duration
             and test $cmd_duration -gt $__done_min_cmd_duration # longer than notify_duration
-            and not __done_is_process_window_focused # process pane or window not focused
+            # and not __done_is_process_window_focused # process pane or window not focused

@chipbuster chipbuster changed the title Notifications now showing on Wayland due to focused window detection Notifications not showing on Wayland due to focused window detection Nov 9, 2023
@zoechi
Copy link

zoechi commented Oct 28, 2024

I'm using wezterm and also don't care about whether the same window is active or not.
Wayland is becoming quite common, so this issue might make the whole plugin obsolete.

Update:
For me it's working now in Wayland but I don't know what changed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants