forge
Explore
Log in

Don't you dare go Hollow

Extract set_lid_closed()

Browse files at this commit

a4f5c90cf00545cd942c6ae07e3ff727b0bbed30Ivan MolodetskikhParent: 79cdbc5
src/input/mod.rsmodified+2 -3
@@ -3931,9 +3931,8 @@ impl State {
3931 3931
3932 if switch == Switch::Lid {3932 if switch == Switch::Lid {
3933 let is_closed = evt.state() == SwitchState::On;3933 let is_closed = evt.state() == SwitchState::On;
3934- debug!("lid switch {}", if is_closed { "closed" } else { "opened" });3934+ trace!("lid switch {}", if is_closed { "closed" } else { "opened" });
3935- self.niri.is_lid_closed = is_closed;3935+ self.set_lid_closed(is_closed);
3936- self.backend.on_output_config_changed(&mut self.niri);
3937 }3936 }
3938 3937
3939 let action = {3938 let action = {
src/niri.rsmodified+10 -0
@@ -726,6 +726,16 @@ impl State {
726 self.niri.notified_activity_this_iteration = false;726 self.niri.notified_activity_this_iteration = false;
727 }727 }
728 728
729+ pub fn set_lid_closed(&mut self, is_closed: bool) {
730+ if self.niri.is_lid_closed == is_closed {
731+ return;
732+ }
733+
734+ debug!("laptop lid {}", if is_closed { "closed" } else { "opened" });
735+ self.niri.is_lid_closed = is_closed;
736+ self.backend.on_output_config_changed(&mut self.niri);
737+ }
738+
729 fn refresh(&mut self) {739 fn refresh(&mut self) {
730 let _span = tracy_client::span!("State::refresh");740 let _span = tracy_client::span!("State::refresh");
731 741