diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/layout/mod.rs | 2 | ||||
| -rw-r--r-- | src/layout/monitor.rs | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 2b684ddf..6407c7a1 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -1854,7 +1854,7 @@ impl<W: LayoutElement> Layout<W> { .map(|name| { monitors .iter_mut() - .position(|monitor| monitor.output.name().eq_ignore_ascii_case(name)) + .position(|monitor| monitor.output_name().eq_ignore_ascii_case(name)) .unwrap_or(*primary_idx) }) .unwrap_or(*active_monitor_idx); diff --git a/src/layout/monitor.rs b/src/layout/monitor.rs index 07223521..df63a189 100644 --- a/src/layout/monitor.rs +++ b/src/layout/monitor.rs @@ -34,6 +34,8 @@ const WORKSPACE_GESTURE_RUBBER_BAND: RubberBand = RubberBand { pub struct Monitor<W: LayoutElement> { /// Output for this monitor. pub output: Output, + /// Cached name of the output. + output_name: String, // Must always contain at least one. pub workspaces: Vec<Workspace<W>>, /// Index of the currently active workspace. @@ -93,6 +95,7 @@ impl WorkspaceSwitch { impl<W: LayoutElement> Monitor<W> { pub fn new(output: Output, workspaces: Vec<Workspace<W>>, options: Rc<Options>) -> Self { Self { + output_name: output.name(), output, workspaces, active_workspace_idx: 0, @@ -102,6 +105,10 @@ impl<W: LayoutElement> Monitor<W> { } } + pub fn output_name(&self) -> &String { + &self.output_name + } + pub fn active_workspace_ref(&self) -> &Workspace<W> { &self.workspaces[self.active_workspace_idx] } |
