aboutsummaryrefslogtreecommitdiff
path: root/src/window/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/window/mod.rs')
-rw-r--r--src/window/mod.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/window/mod.rs b/src/window/mod.rs
index 44d5359e..1cf576df 100644
--- a/src/window/mod.rs
+++ b/src/window/mod.rs
@@ -115,6 +115,21 @@ impl<'a> WindowRef<'a> {
WindowRef::Mapped(mapped) => mapped.is_active_in_column(),
}
}
+
+ pub fn is_floating(self) -> bool {
+ match self {
+ // FIXME: This means you cannot set initial configure rules based on is-floating. I'm
+ // not sure there's a good way to support it, since this matcher makes a cycle with the
+ // open-floating rule.
+ //
+ // That said, I don't think there are a lot of useful initial configure properties you
+ // may want to set through an is-floating matcher? Like, if you're configuring a
+ // specific window to open as floating, you can also set those properties in that same
+ // window rule, rather than relying on a different is-floating rule.
+ WindowRef::Unmapped(_) => false,
+ WindowRef::Mapped(mapped) => mapped.is_floating(),
+ }
+ }
}
impl ResolvedWindowRules {
@@ -381,5 +396,11 @@ fn window_matches(window: WindowRef, role: &XdgToplevelSurfaceRoleAttributes, m:
}
}
+ if let Some(is_floating) = m.is_floating {
+ if window.is_floating() != is_floating {
+ return false;
+ }
+ }
+
true
}