Add a window swap operation (#899)

Swap the active window with the a neighboring column's active window.


---------

Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
Take into account PR comments

- no longer behave like an expel when a swap is made in a direction
  where there is no column to swap with
- fix janky animation
This commit is contained in:
rustn00b
2025-01-09 08:29:36 +00:00
committed by GitHub
parent 8412bfb813
commit 80815a1591
7 changed files with 191 additions and 2 deletions
+5 -1
View File
@@ -9,7 +9,7 @@ use smithay::backend::renderer::element::utils::{
use smithay::output::Output;
use smithay::utils::{Logical, Point, Rectangle, Size};
use super::scrolling::{Column, ColumnWidth};
use super::scrolling::{Column, ColumnWidth, ScrollDirection};
use super::tile::Tile;
use super::workspace::{
OutputId, Workspace, WorkspaceAddWindowTarget, WorkspaceId, WorkspaceRenderElement,
@@ -707,6 +707,10 @@ impl<W: LayoutElement> Monitor<W> {
self.active_workspace().expel_from_column();
}
pub fn swap_window_in_direction(&mut self, direction: ScrollDirection) {
self.active_workspace().swap_window_in_direction(direction);
}
pub fn center_column(&mut self) {
self.active_workspace().center_column();
}