aboutsummaryrefslogtreecommitdiff
path: root/src/layout/monitor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout/monitor.rs')
-rw-r--r--src/layout/monitor.rs7
1 files changed, 7 insertions, 0 deletions
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]
}