altdesktop / i3ipc-python

🐍 An improved Python library to control i3wm and sway.
http://i3ipc-python.readthedocs.io
BSD 3-Clause "New" or "Revised" License
851 stars 109 forks source link

No window events for popup menus? #151

Closed Galicarnax closed 4 years ago

Galicarnax commented 4 years ago

I'm not sure this issue is specifically about i3ipc-python - probably it is about i3-ipc itself. But since I've been using i3 IPC only via i3ipc-python, let me ask here. I've found that rofi and other popup menus do not produce events - neither WINDOW_NEW nor WINDOW_FOCUS, so in my subscribed client I just can't track when these kind of popup windows appear or gain focus. Is there any solution/workaround? Is it a specific restriction on the part of i3?

acrisci commented 4 years ago

Some windows like these are not managed by i3 and are not in the tree. The window requests not to be managed by setting the override_redirect member on the call to map the window in X11 and i3 ignores it. It doesn't handle focus for these windows either. Rofi gets the keyboard input without affecting WM focus.

You could get these events with an X11 client like python-xlib by listening to the MapRequest event.

Galicarnax commented 4 years ago

Thanks for the explanation! I'll see into python-xlib.

acrisci commented 4 years ago

For the focus events, you could make the case on i3 that keyboard focus is the same thing as WM focus and if no managed window is getting keyboard focus because rofi has grabbed it, i3 should unset window focus and send a window focus with a null container over the ipc. You could open an issue for that if you want to pursue it. But it's definitely the case that override redirect windows do not belong in the tree.