diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-01-23 10:40:52 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-01-23 11:13:55 +0300 |
| commit | a10705fb200b452802a1ba7cd47679536e0ef849 (patch) | |
| tree | 7e12f0602c4652e043021392632e7e4e24ebb4fe /src/window | |
| parent | b01b8afa8c8f9070300243050d9790e38fd19145 (diff) | |
| download | niri-a10705fb200b452802a1ba7cd47679536e0ef849.tar.gz niri-a10705fb200b452802a1ba7cd47679536e0ef849.tar.bz2 niri-a10705fb200b452802a1ba7cd47679536e0ef849.zip | |
Add toggle-window-rule-opacity action
Diffstat (limited to 'src/window')
| -rw-r--r-- | src/window/mapped.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/window/mapped.rs b/src/window/mapped.rs index 207140c4..71b6c9da 100644 --- a/src/window/mapped.rs +++ b/src/window/mapped.rs @@ -69,6 +69,9 @@ pub struct Mapped { /// Whether this window is floating. is_floating: bool, + /// Whether this window should ignore opacity set through window rules. + ignore_opacity_window_rule: bool, + /// Buffer to draw instead of the window when it should be blocked out. block_out_buffer: RefCell<SolidColorBuffer>, @@ -167,6 +170,7 @@ impl Mapped { is_focused: false, is_active_in_column: true, is_floating: false, + ignore_opacity_window_rule: false, block_out_buffer: RefCell::new(SolidColorBuffer::new((0., 0.), [0., 0., 0., 1.])), animate_next_configure: false, animate_serials: Vec::new(), @@ -192,6 +196,12 @@ impl Mapped { return false; } + // If the opacity window rule no longer makes the window semitransparent, reset the ignore + // flag to reduce surprises down the line. + if !new_rules.opacity.is_some_and(|o| o < 1.) { + self.ignore_opacity_window_rule = false; + } + self.rules = new_rules; true } @@ -228,6 +238,10 @@ impl Mapped { self.is_floating } + pub fn toggle_ignore_opacity_window_rule(&mut self) { + self.ignore_opacity_window_rule = !self.ignore_opacity_window_rule; + } + pub fn set_is_focused(&mut self, is_focused: bool) { if self.is_focused == is_focused { return; @@ -839,6 +853,10 @@ impl LayoutElement for Mapped { .with_pending_state(|state| state.states.contains(xdg_toplevel::State::Fullscreen)) } + fn is_ignoring_opacity_window_rule(&self) -> bool { + self.ignore_opacity_window_rule + } + fn requested_size(&self) -> Option<Size<i32, Logical>> { self.toplevel().with_pending_state(|state| state.size) } |
