forge
Explore
Log in

Don't you dare go Hollow

layout: Replace move_column_to_workspace_up/down with move_column_to_workspace

Browse files at this commit

d6d80054a248ffdd30e4c49c30f550c2c3cb6aa1Ivan MolodetskikhParent: b537dda
src/layout/monitor.rsmodified+4 -46
@@ -850,55 +850,13 @@ impl<W: LayoutElement> Monitor<W> {
850 }850 }
851 851
852 pub fn move_column_to_workspace_up(&mut self, activate: bool) {852 pub fn move_column_to_workspace_up(&mut self, activate: bool) {
853- let source_workspace_idx = self.active_workspace_idx;853+ let new_idx = self.active_workspace_idx.saturating_sub(1);
854-854+ self.move_column_to_workspace(new_idx, activate);
855- let new_idx = source_workspace_idx.saturating_sub(1);
856- if new_idx == source_workspace_idx {
857- return;
858- }
859-
860- let workspace = &mut self.workspaces[source_workspace_idx];
861- if workspace.floating_is_active() {
862- let activate = if activate {
863- ActivateWindow::Smart
864- } else {
865- ActivateWindow::No
866- };
867- self.move_to_workspace_up(activate);
868- return;
869- }
870-
871- let Some(column) = workspace.remove_active_column() else {
872- return;
873- };
874-
875- self.add_column(new_idx, column, activate);
876 }855 }
877 856
878 pub fn move_column_to_workspace_down(&mut self, activate: bool) {857 pub fn move_column_to_workspace_down(&mut self, activate: bool) {
879- let source_workspace_idx = self.active_workspace_idx;858+ let new_idx = min(self.active_workspace_idx + 1, self.workspaces.len() - 1);
880-859+ self.move_column_to_workspace(new_idx, activate);
881- let new_idx = min(source_workspace_idx + 1, self.workspaces.len() - 1);
882- if new_idx == source_workspace_idx {
883- return;
884- }
885-
886- let workspace = &mut self.workspaces[source_workspace_idx];
887- if workspace.floating_is_active() {
888- let activate = if activate {
889- ActivateWindow::Smart
890- } else {
891- ActivateWindow::No
892- };
893- self.move_to_workspace_down(activate);
894- return;
895- }
896-
897- let Some(column) = workspace.remove_active_column() else {
898- return;
899- };
900-
901- self.add_column(new_idx, column, activate);
902 }860 }
903 861
904 pub fn move_column_to_workspace(&mut self, idx: usize, activate: bool) {862 pub fn move_column_to_workspace(&mut self, idx: usize, activate: bool) {