Faster Moves in i3a
- sway, i3, i3a, release notes
- 6
- finished
When master window has focus while i3a works in master-stack mode, new windows actually spawn between master and stack areas. i3a moves them to the stack area and refocuses them, because they lose focus during the move. This isn’t atomic operation and its performance affects how noticable it is. Until today it was very noticable: you could clearly see new window appearing and disappearing and also resizing of master window.
The culprit was, unexpectedly, the focus
command, which i3a called
separately after move:
[con_id="<container.id>"] move window to mark __i3a_stack
[con_id="<container.id>"] focus
It turns out that if you quickly run equivalents of these commands via Sway’s
IPC interface, focus
slows down move
! Which should already happen! Crazy!
(sidenote: Or maybe not so crazy in async world. I guess that Sway
responds to IPC faster than it does the actual move/redraw.)
To fix this I chained the two commands with a colon. Colon part is important,
because Sway and i3 may chain commands with either a colon or semicolon and
they convey different meanings: colon preserves criteria (the [con_id]
part) and semicolon doesn’t.
Now i3a runs something like this:
[con_id="<container.id>"] move window to mark __i3a_stack, focus
It’s still visible that windows initially spawn between master and stack areas, but they disappear so quickly that it’s barely noticable. I don’t think I can go any further with this, because i3 and Sway don’t expose any interface which notifies clients about windows before they appear on the screen.
This improvement landed in i3a 2.2.3.