core/placement: change quicktile hotkeys to work relatively
Currently, the quicktile hotkeys are "absolute" in the sense that pressing "Meta+Left" always tile the window to the left half of the screen, regardless of its current quicktile position.
!50 (merged) @ngraham partially changed this behavior so that if you press "Meta+Left" followed by "Meta+Up" in one second, the window will be tiled to the top-left.
This commit generalizes the above behavior so it works any time, without the one-second limit. This is inspired by the COSMIC desktop's design.
demo: Screencast_20240901_072013
The new behavior is as follows:
+--------------+-------------+--------------+-----------+--------------+
| current pos | key:left | right | up | down |
+--------------+-------------+--------------+-----------+--------------+
| left | no change | restore | top-left | bottom-left |
| right | restore | no change | top-right | bottom-right |
| up | top-left | top-right | no change | restore |
| down | bottom-left | bottom-right | restore | no change |
| top-left | no change | top | no change | left |
| top-right | top | no change | no change | right |
| bottom-left | no change | bottom | left | no change |
| bottom-right | bottom | no change | right | no change |
| normal | left | right | top | bottom |
| maximized | left | right | top | bottom |
+--------------+-------------+--------------+-----------+--------------
Diagonal hotkeys like "quicktile to top-left" are processed as left then up.
Pros:
- I find this model ("moving / spanning window to this direction") more natural.
- Currently when a window is already tiled to left and the user presses "meta+left" again, it moves to the screen on the left side, and tiles to right. This also matches the "moving window" mental model than an absolute one.
- Fewer key presses to move a window to adjacent positions, e.g. from "left" to "top-left".
Cons:
- More key presses to move a window to the opposite position, e.g. it now requires two "meta+right" to move a window from "left" to "right".
Edited by Jin Liu