Skip to content

Commit

Permalink
Update insert hint after workspace shift
Browse files Browse the repository at this point in the history
  • Loading branch information
Pajn committed Aug 17, 2024
1 parent 06e72c0 commit 758a93b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/layout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1615,34 +1615,39 @@ impl<W: LayoutElement> Layout<W> {
return;
};
monitor.switch_workspace_up();
self.update_insert_hint();
}

pub fn switch_workspace_down(&mut self) {
let Some(monitor) = self.active_monitor() else {
return;
};
monitor.switch_workspace_down();
self.update_insert_hint();
}

pub fn switch_workspace(&mut self, idx: usize) {
let Some(monitor) = self.active_monitor() else {
return;
};
monitor.switch_workspace(idx, false);
self.update_insert_hint();
}

pub fn switch_workspace_auto_back_and_forth(&mut self, idx: usize) {
let Some(monitor) = self.active_monitor() else {
return;
};
monitor.switch_workspace_auto_back_and_forth(idx);
self.update_insert_hint();
}

pub fn switch_workspace_previous(&mut self) {
let Some(monitor) = self.active_monitor() else {
return;
};
monitor.switch_workspace_previous();
self.update_insert_hint();
}

pub fn consume_into_column(&mut self) {
Expand Down Expand Up @@ -1994,6 +1999,19 @@ impl<W: LayoutElement> Layout<W> {
}
}
}

fn update_insert_hint(&mut self) {
if let Some(move_) = &self.interactive_move {
if let Some(workspace) = self.workspace_for_output_mut(&move_.output) {
let position = workspace.get_insert_position(move_.get_pointer_loc());
workspace.set_insert_hint(InsertHint {
position,
width: move_.width,
is_full_width: move_.is_full_width,
});
}
}
}

pub fn ensure_named_workspace(&mut self, ws_config: &WorkspaceConfig) {
if self.find_workspace_by_name(&ws_config.name.0).is_some() {
Expand Down

0 comments on commit 758a93b

Please sign in to comment.