Open QbDesu opened 4 years ago
I don’t use or have Linux, but a PR is welcome to improve the behavior.
The ActivityWatch project has a similar problem with Wayland: https://github.com/ActivityWatch/activitywatch/issues/92
So far, they seem to have found a workaround for Gnome.
This shell command can retrieve the active Window application name for Wayland + Gnome:
gdbus call -e -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval global.get_window_actors\(\)[`gdbus call -e -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval global.get_window_actors\(\).findIndex\(a\=\>a.meta_window.has_focus\(\)===true\) | cut -d"'" -f 2`].get_meta_window\(\).get_wm_class\(\) | cut -d'"' -f 2
If there are no other options, this might be an approach to support a large portion of Wayland users.
@sindresorhus I can confirm that, on Wayland, this is impossible by design. It's a security measure, meant to prevent windows from spying on each other. See https://stackoverflow.com/questions/4546501
PR incoming :smiley:
@tkainrad According to this StackExchange answer, Gnome 41 doesn't allow that workaround anymore.
Although Wayland doesn't support EWMH/ICCCM by design, Wayland compositors may provide equivalent functionality, like wlr-foreign-toplevel-management. This might inspire a future PR: https://github.com/activitywatch/aw-watcher-window-wayland
Fails without further notice if
xprop
orxwininfo
because they are either not installed, or not present in thePATH
variable. If you ask me the promise should fail with a proper error when something fails (or throw an Error for the sync variant). The current behaviour makes debugging the root of the problem quite difficult.https://github.com/sindresorhus/active-win/blob/430e6efc02823c1b04331a987012a519c360ab23/lib/linux.js#L109-L111
Also you might want to add that there is no Wayland support at the moment to the documentation especially considering the increasing popularity of Wayland.
I might PR this myself when I find the time.