Closed user202729 closed 1 year ago
Hi! Thank you for your help! I didn't know about xmonad at all (just curious, what advantages it has versus other window managers?).
pyewmh and pywinctl rely on EWMH specs ("_NET_ACTIVE_WINDOW", in this case). Making a quick search, I have found that EWMH must be explicitly enabled in xmonad (see here). Perhaps this can fix the issue... but not sure if this is acceptable for some or all xmonad users.
I will test your solution to check if it works in all cases and other methods (thank you!!!) Perhaps it can also work with Wayland, in which I recently discovered that retrieving the active window or any window title is not working either.
It's a tiling window manager (homepage https://xmonad.org/). (anecdote, some people find xmonad a bit too difficult to configure and use i3 instead)
As xdotool documentation states, getactivewindow is more reliable than getwindowfocus so maybe only use the latter if the former is unavailable.
As for Wayland, I don't use it so don't have experience but as the library is named Xlib I think it probably won't work either. There's the pywayland
library, maybe it will be useful for something. [edit: looks a bit more difficult I can find https://askubuntu.com/questions/1414320/how-to-get-current-active-window-in-ubuntu-22-04 https://unix.stackexchange.com/questions/399753/how-to-get-a-list-of-active-windows-when-using-wayland ]
Yes I should have figured that one out earlier. I change xmobar def {...}
in my config with xmobar (ewmh def {...})
and add import XMonad.Hooks.EwmhDesktops
, and pywinctl works without any change. Similarly xdotool getactivewindow
also works now. {later edit: enabling ewmh has the side effect of making zathura --synctex-forward
switch focus to the zathura window, will figure out later}
Hi! Sorry for my late reply, but I was completely unable to install xmonad in my (actual, not VM) Ubuntu installation. I already read about activating ewmh in Xmonad (also because we are working in a pyewmh module replacement). In fact, that was my first option, but I never could confirm... Thank you so much for your feedback!!!! I do really appreciate it.
As in the title.
I think I know how and figure out an alternative working solution, refer to https://stackoverflow.com/a/76394437/5267751. But it still seems a bit fickle.