From 9896fd67a0dcdade5f05568aa7b12fa17605976b Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Wed, 7 Feb 2024 10:49:01 +0400 Subject: Open dialogs to the right of their parent, don't steal focus --- src/layout/monitor.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/layout/monitor.rs') diff --git a/src/layout/monitor.rs b/src/layout/monitor.rs index 0e5802cd..f5da804a 100644 --- a/src/layout/monitor.rs +++ b/src/layout/monitor.rs @@ -126,6 +126,31 @@ impl Monitor { } } + pub fn add_window_right_of( + &mut self, + right_of: &W, + window: W, + activate: bool, + width: ColumnWidth, + is_full_width: bool, + ) { + let workspace_idx = self + .workspaces + .iter_mut() + .position(|ws| ws.has_window(right_of)) + .unwrap(); + let workspace = &mut self.workspaces[workspace_idx]; + + workspace.add_window_right_of(right_of, window, activate, width, is_full_width); + + // After adding a new window, workspace becomes this output's own. + workspace.original_output = OutputId::new(&self.output); + + if activate { + self.activate_workspace(workspace_idx); + } + } + pub fn add_column(&mut self, workspace_idx: usize, column: Column, activate: bool) { let workspace = &mut self.workspaces[workspace_idx]; -- cgit