SwayNotificationCenter icon indicating copy to clipboard operation
SwayNotificationCenter copied to clipboard

[Bug] Notification grabs cursor focus when appears

Open mooncoffee1 opened this issue 1 year ago • 5 comments

Please read through the README and the Man pages before submitting Please also make sure that there isn't any prior issue describing this bug

Describe the bug On arch linux Hyprland, focus problem.

To Reproduce Steps to reproduce the behavior: Get a notification your focus from a window goes away. u need to remove the window to the previously focused window

Expected behavior to not react with the cursor nor the focused window

Please provide logs if you're experiencing notification errors / bugs Attach Gists for swaync logs by running G_MESSAGES_DEBUG=all swaync and (if applicable) application logs.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Fedora 37]
  • Version [e.g. 0.7]

Additional context Add any other context about the problem here.

mooncoffee1 avatar Jul 27 '24 17:07 mooncoffee1

Can you attach a swaync log?

ErikReider avatar Jul 28 '24 13:07 ErikReider

Can you attach a swaync log?

G_MESSAGES_DEBUG=all swaync (swaync:18206): GLib-GIO-DEBUG: 12:33:01.074: Using cross-namespace EXTERNAL authentication (this will deadlock if server is GDBus < 2.73.3) (swaync:18206): GLib-GIO-DEBUG: 12:33:01.075: _g_io_module_get_default: Found default implementation dconf (DConfSettingsBackend) for ‘gsettings-backend’ (swaync:18206): dconf-DEBUG: 12:33:01.075: watch_fast: "/org/gnome/desktop/interface/" (establishing: 0, active: 0) (swaync:18206): dconf-DEBUG: 12:33:01.075: watch_fast: "/org/gnome/desktop/peripherals/mouse/" (establishing: 0, active: 0) (swaync:18206): dconf-DEBUG: 12:33:01.075: watch_fast: "/org/gnome/desktop/sound/" (establishing: 0, active: 0) (swaync:18206): dconf-DEBUG: 12:33:01.075: watch_fast: "/org/gnome/desktop/privacy/" (establishing: 0, active: 0) (swaync:18206): dconf-DEBUG: 12:33:01.075: watch_fast: "/org/gnome/desktop/wm/preferences/" (establishing: 0, active: 0) (swaync:18206): dconf-DEBUG: 12:33:01.075: watch_fast: "/org/gnome/settings-daemon/plugins/xsettings/" (establishing: 0, active: 0) (swaync:18206): dconf-DEBUG: 12:33:01.075: watch_fast: "/org/gnome/desktop/a11y/" (establishing: 0, active: 0) (swaync:18206): dconf-DEBUG: 12:33:01.075: watch_fast: "/org/gnome/desktop/a11y/interface/" (establishing: 0, active: 0) (swaync:18206): dconf-DEBUG: 12:33:01.076: watch_established: "/org/gnome/desktop/interface/" (establishing: 1) (swaync:18206): dconf-DEBUG: 12:33:01.076: watch_established: "/org/gnome/desktop/peripherals/mouse/" (establishing: 1) (swaync:18206): dconf-DEBUG: 12:33:01.076: watch_established: "/org/gnome/desktop/sound/" (establishing: 1) (swaync:18206): dconf-DEBUG: 12:33:01.076: watch_established: "/org/gnome/desktop/privacy/" (establishing: 1) (swaync:18206): dconf-DEBUG: 12:33:01.076: watch_established: "/org/gnome/desktop/wm/preferences/" (establishing: 1) (swaync:18206): dconf-DEBUG: 12:33:01.076: watch_established: "/org/gnome/settings-daemon/plugins/xsettings/" (establishing: 1) (swaync:18206): dconf-DEBUG: 12:33:01.076: watch_established: "/org/gnome/desktop/a11y/" (establishing: 1) (swaync:18206): dconf-DEBUG: 12:33:01.076: watch_established: "/org/gnome/desktop/a11y/interface/" (establishing: 1) (swaync:18206): Gdk-DEBUG: 12:33:01.101: Compositor prefers decoration mode 'server' (swaync:18206): GLib-DEBUG: 12:33:01.101: unsetenv() is not thread-safe and should not be used after threads are created (swaync:18206): GLib-GIO-DEBUG: 12:33:01.107: _g_io_module_get_default: Found default implementation gvfs (GDaemonVfs) for ‘gio-vfs’ (swaync:18206): dconf-DEBUG: 12:33:01.163: watch_fast: "/org/erikreider/swaync/" (establishing: 0, active: 0) ** INFO: 12:33:01.163: functions.vala:180: Looking for config file in these directories: - /home/ananas/.config/swaync/config.json - /etc/xdg/swaync/config.json - /usr/local/etc/xdg/swaync/config.json ** INFO: 12:33:01.163: functions.vala:180: Looking for config file in these directories: - /home/ananas/.config/swaync/config.json - /home/ananas/.config/swaync/config.json - /etc/xdg/swaync/config.json - /usr/local/etc/xdg/swaync/config.json ** Message: 12:33:01.163: configModel.vala:289: Loading Config: "/home/ananas/.config/swaync/config.json" (swaync:18206): dconf-DEBUG: 12:33:01.164: watch_established: "/org/erikreider/swaync/" (establishing: 1) ** (swaync:18206): DEBUG: 12:33:01.164: configModel.vala:314: { "positionX" : "right", "positionY" : "bottom", "layer" : "top", "layer-shell" : true, "cssPriority" : "application", "timeout" : 10, "timeout-low" : 5, "timeout-critical" : 0, "transition-time" : 100, "keyboard-shortcuts" : true, "image-visibility" : "when-available", "notification-window-width" : 400, "hide-on-clear" : true, "hide-on-action" : false, "control-center-positionX" : "right", "control-center-positionY" : "center", "control-center-margin-top" : 20, "control-center-margin-bottom" : 20, "control-center-margin-left" : 0, "control-center-margin-right" : 10, "control-center-layer" : "top", "control-center-exclusive-zone" : true, "categories-settings" : { }, "notification-visibility" : { }, "scripts" : { }, "script-fail-notify" : true, "fit-to-screen" : true, "relative-timestamps" : true, "control-center-height" : 300, "control-center-width" : 500, "notification-2fa-action" : true, "notification-inline-replies" : true, "notification-icon-size" : 40, "notification-body-image-height" : 100, "notification-body-image-width" : 200, "widgets" : [ "mpris", "title", "notifications" ], "widget-config" : { "buttons-grid" : { "actions" : [ { "active" : false, "command" : "systemctl suspend", "label" : "󰤄", "type" : "toggle" }, { "active" : false, "command" : "systemctl hibernate", "label" : "", "type" : "toggle" }, { "active" : false, "command" : "hyprshot -m region --clipboard-only", "label" : "󰄀", "type" : "button" }, { "active" : false, "command" : "kooha", "label" : "󰕧", "type" : "button" }, { "active" : false, "command" : "asusctl profile -n", "label" : "󰾅", "type" : "toggle" }, { "active" : false, "command" : "wlogout", "label" : "", "type" : "toggle" } ] }, "mpris" : { "image-radius" : 12, "image-size" : 96 }, "backlight" : { "label" : " ", "device" : "nvidia_wmi_ec_backlight" }, "title" : { "text" : "Notifications", "button-text" : " 󰎟 ", "clear-all-button" : true } } } ** INFO: 12:33:01.164: functions.vala:138: Looking for CSS file in these directories: - /etc/xdg/swaync/style.css - /usr/local/etc/xdg/swaync/style.css ** Message: 12:33:01.164: functions.vala:86: Loading CSS: "/etc/xdg/swaync/style.css" ** INFO: 12:33:01.165: functions.vala:138: Looking for CSS file in these directories: - /home/ananas/.config/swaync/style.css - /etc/xdg/swaync/style.css - /usr/local/etc/xdg/swaync/style.css ** Message: 12:33:01.165: functions.vala:100: Loading CSS: "/home/ananas/.config/swaync/style.css" ** (swaync:18206): DEBUG: 12:33:01.174: baseWidget.vala:59: mpris: Config doesn't have key: blur!

** Message: 12:33:01.183: factory.vala:44: Loading widget: mpris ** Message: 12:33:01.183: factory.vala:44: Loading widget: title Could not acquire notification name. Please close any other notification daemon like mako or dunst

mooncoffee1 avatar Aug 04 '24 09:08 mooncoffee1

Great, could you also provide the output when receiving the focus grabbing notification?

ErikReider avatar Aug 04 '24 14:08 ErikReider

Great, could you also provide the output when receiving the focus grabbing notification?

https://github.com/user-attachments/assets/fa22e358-4bbf-4b0a-a511-0c8b643288a3

yes, sure, here you can see im typing random letters in terminal, just pressing on the key, and when notification appears, i stop typing, thats beacause it stole the focus, and i need to refocus in the window

mooncoffee1 avatar Aug 05 '24 21:08 mooncoffee1

Great, could you also provide the output when receiving the focus grabbing notification?

i tried from config file with

"notification-2fa-action": false,

but the notification actions still appear

mooncoffee1 avatar Aug 24 '24 13:08 mooncoffee1

I'm experincing the same issue on hyprland.

nickconway avatar Nov 28 '24 04:11 nickconway

This does seem like a hyprland issue. The notifications are set to on_demand keyboard interactivity and most of the other compositors require the user to explicitly focus the layer surface when it's mapped. Seems like hyprland grabs the focus instead. Not much that I can do about it.

Might wanna open an issue in the hyprland repo and see what vaxry thinks :)

ErikReider avatar Nov 28 '24 09:11 ErikReider

Seems like an old issue. I got a workaround by added float_switch_override_focus = 2 in input section.

However this workaround sometimes works but result is okay for me.

wolf-yuan-6115 avatar Jan 28 '25 09:01 wolf-yuan-6115

Closing due to it being a Hyprland issue

ErikReider avatar Mar 02 '25 14:03 ErikReider

I was facing same this week. I noticed this only happens when there is a inline-reply in the notification. So I just set these two to false:

 "notification-2fa-action": false,
 "notification-inline-replies": false,

This fixed the focus grab issue for me.

SherLock707 avatar Mar 16 '25 17:03 SherLock707