diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-05-06 16:51:18 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-05-06 17:34:40 +0300 |
| commit | 3e31c134a602dd876f2b446071e5802fa4a0c3ec (patch) | |
| tree | 0c162b432ee4964e66d24521b3728b447d90afdb /src/layer | |
| parent | fe682938db2a0aa6e6ffb105a51051a5946a8143 (diff) | |
| download | niri-3e31c134a602dd876f2b446071e5802fa4a0c3ec.tar.gz niri-3e31c134a602dd876f2b446071e5802fa4a0c3ec.tar.bz2 niri-3e31c134a602dd876f2b446071e5802fa4a0c3ec.zip | |
Implement place-within-backdrop layer rule
Diffstat (limited to 'src/layer')
| -rw-r--r-- | src/layer/mapped.rs | 18 | ||||
| -rw-r--r-- | src/layer/mod.rs | 7 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/layer/mapped.rs b/src/layer/mapped.rs index 5e62d033..78cfadbf 100644 --- a/src/layer/mapped.rs +++ b/src/layer/mapped.rs @@ -6,6 +6,7 @@ use smithay::backend::renderer::element::surface::{ use smithay::backend::renderer::element::Kind; use smithay::desktop::{LayerSurface, PopupManager}; use smithay::utils::{Logical, Point, Scale, Size}; +use smithay::wayland::shell::wlr_layer::{ExclusiveZone, Layer}; use super::ResolvedLayerRules; use crate::layout::shadow::Shadow; @@ -96,6 +97,23 @@ impl MappedLayer { true } + pub fn place_within_backdrop(&self) -> bool { + if !self.rules.place_within_backdrop { + return false; + } + + if self.surface.layer() != Layer::Background { + return false; + } + + let state = self.surface.cached_state(); + if state.exclusive_zone != ExclusiveZone::DontCare { + return false; + } + + true + } + pub fn render<R: NiriRenderer>( &self, renderer: &mut R, diff --git a/src/layer/mod.rs b/src/layer/mod.rs index 36e7ee67..3b27737c 100644 --- a/src/layer/mod.rs +++ b/src/layer/mod.rs @@ -19,6 +19,9 @@ pub struct ResolvedLayerRules { /// Corner radius to assume this layer surface has. pub geometry_corner_radius: Option<CornerRadius>, + + /// Whether to place this layer surface within the overview backdrop. + pub place_within_backdrop: bool, } impl ResolvedLayerRules { @@ -37,6 +40,7 @@ impl ResolvedLayerRules { inactive_color: None, }, geometry_corner_radius: None, + place_within_backdrop: false, } } @@ -73,6 +77,9 @@ impl ResolvedLayerRules { if let Some(x) = rule.geometry_corner_radius { resolved.geometry_corner_radius = Some(x); } + if let Some(x) = rule.place_within_backdrop { + resolved.place_within_backdrop = x; + } resolved.shadow.merge_with(&rule.shadow); } |
