Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scroll windows when swiping on trackpad
For each space, cache the virtual window x positions. That's the position the window would be if it were tiled infinitely in each direction (left and right) of the screen. These virtual positions can be negative. In reality, windows that extend past the visible screen are stashed in a one pixel wide margin. Add a swipe.lua helper utility to detect touches on the trackpad, determine when a swipe gesture begins and ends, and calculate the average delta x and y position changes. Note, we're unable to handle mouse scroll wheel movements because there is no begin or end event. In a swipe handler, find the focused window and space and cache the screen geometry to use for future moved updates in the same swipe gesture. Calculate the new x position for each window in the space, bound them to not go past the screen margins, and use window:setTopLeft() to avoid the animation duration. Disable the window moved watcher while a swipe gesture is in progress, and windows are being scrolled. When a swipe is done, if the focused window has been moved off screen, snap focus to the on screen window closest to the focused window. Then retile to ensure the focused window is completely on screen.
- Loading branch information