swaywm / sway

i3-compatible Wayland compositor
https://swaywm.org
MIT License
14.58k stars 1.11k forks source link

Missing events #7757

Open smurfix opened 1 year ago

smurfix commented 1 year ago

I want to write a script that keeps track of Sway's window hierarchy so I don't have to call "get_tree" every time I want to move a window.

However, currently this doesn't seem to be possible.

Sway Version: 1.7

Description:

(a) changing focus doesn't always result in an event

(b) changing the window structure doesn't always cause events

Use case: I'd like to write a little tool that shows the window structure and allows the user to move their windows and containers around. I want it to reflect the actual screen – without eating battery power by doing a preemptive "get_tree" every second.

Use case 2: auto-placing new windows requires an accurate view of the system. Sway behaves in subtly different ways when a window is inside a sub-container.

t3e commented 5 months ago

I've come across this as well when trying to implement the title to be displayed in the sway-bar status command. When I have a floating window and run "focus parent", there seems to be no event generated (as mentioned). This is a little annoying because this way I cannot update the title bar when there no focus on a window.