diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-10-18 08:51:27 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-10-18 09:14:57 +0300 |
| commit | a4f5c90cf00545cd942c6ae07e3ff727b0bbed30 (patch) | |
| tree | aed32efe2cb88d5c237a071cea2c39b1d91c18e0 /src | |
| parent | 79cdbc5748fde39365198b7e65936ec45be1d520 (diff) | |
| download | niri-a4f5c90cf00545cd942c6ae07e3ff727b0bbed30.tar.gz niri-a4f5c90cf00545cd942c6ae07e3ff727b0bbed30.tar.bz2 niri-a4f5c90cf00545cd942c6ae07e3ff727b0bbed30.zip | |
Extract set_lid_closed()
Diffstat (limited to 'src')
| -rw-r--r-- | src/input/mod.rs | 5 | ||||
| -rw-r--r-- | src/niri.rs | 10 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/input/mod.rs b/src/input/mod.rs index 42f90879..876295a2 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -3931,9 +3931,8 @@ impl State { if switch == Switch::Lid { let is_closed = evt.state() == SwitchState::On; - debug!("lid switch {}", if is_closed { "closed" } else { "opened" }); - self.niri.is_lid_closed = is_closed; - self.backend.on_output_config_changed(&mut self.niri); + trace!("lid switch {}", if is_closed { "closed" } else { "opened" }); + self.set_lid_closed(is_closed); } let action = { diff --git a/src/niri.rs b/src/niri.rs index 01deae02..d5c6a8b5 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -726,6 +726,16 @@ impl State { self.niri.notified_activity_this_iteration = false; } + pub fn set_lid_closed(&mut self, is_closed: bool) { + if self.niri.is_lid_closed == is_closed { + return; + } + + debug!("laptop lid {}", if is_closed { "closed" } else { "opened" }); + self.niri.is_lid_closed = is_closed; + self.backend.on_output_config_changed(&mut self.niri); + } + fn refresh(&mut self) { let _span = tracy_client::span!("State::refresh"); |
