From 8b4a9d68e0ba8093e88d20f3a003f78ef27cac0e Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 24 Mar 2024 08:30:26 +0400 Subject: Implement opacity window rule --- src/window/mapped.rs | 3 ++- src/window/mod.rs | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src/window') diff --git a/src/window/mapped.rs b/src/window/mapped.rs index a48ca636..52b9ac92 100644 --- a/src/window/mapped.rs +++ b/src/window/mapped.rs @@ -108,13 +108,14 @@ impl LayoutElement for Mapped { renderer: &mut R, location: Point, scale: Scale, + alpha: f32, ) -> Vec> { let buf_pos = location - self.window.geometry().loc; self.window.render_elements( renderer, buf_pos.to_physical_precise_round(scale), scale, - 1., + alpha, ) } diff --git a/src/window/mod.rs b/src/window/mod.rs index 63cdbe3f..ddf712b0 100644 --- a/src/window/mod.rs +++ b/src/window/mod.rs @@ -52,6 +52,9 @@ pub struct ResolvedWindowRules { /// /// `None` means using the SSD heuristic. pub draw_border_with_background: Option, + + /// Extra opacity to draw this window with. + pub opacity: Option, } impl<'a> WindowRef<'a> { @@ -82,6 +85,7 @@ impl ResolvedWindowRules { max_width: None, max_height: None, draw_border_with_background: None, + opacity: None, } } @@ -153,6 +157,9 @@ impl ResolvedWindowRules { if let Some(x) = rule.draw_border_with_background { resolved.draw_border_with_background = Some(x); } + if let Some(x) = rule.opacity { + resolved.opacity = Some(x); + } } resolved.open_on_output = open_on_output.map(|x| x.to_owned()); -- cgit