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
Silently fails under Linux if xwininfo/xprop is missing #75
Comments
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: ActivityWatch/activitywatch#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 😃 @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. |
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.
The text was updated successfully, but these errors were encountered: