jml / undistract-me

Notifies you when long-running terminal commands complete
Other
540 stars 48 forks source link

Fix showing notifications in Wayland apps when running XWayland #71

Open kira-bruneau opened 3 years ago

kira-bruneau commented 3 years ago

XWayland will return 0x0 (the root window id) when a Wayland window is focused, so if you switch to another Wayland window, the notification will not be displayed. To workaround this, I just replaced nowindowid with 0x0 as a marker for no window being focused.

NOTE: This change doesn't implement window checking for Wayland, so notifications from a focused Wayland window will be displayed.

I also added an exit code check to only use the window id from xprop if it succeeds. This isn't essential to support Wayland + XWayland, but it should act as a safe guard if the X connection fails.