mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-22 02:01:55 +07:00
Add login1 LidClosed monitoring
This commit is contained in:
+12
@@ -120,6 +120,8 @@ use crate::cursor::{CursorManager, CursorTextureCache, RenderCursor, XCursor};
|
||||
#[cfg(feature = "dbus")]
|
||||
use crate::dbus::freedesktop_locale1::Locale1ToNiri;
|
||||
#[cfg(feature = "dbus")]
|
||||
use crate::dbus::freedesktop_login1::Login1ToNiri;
|
||||
#[cfg(feature = "dbus")]
|
||||
use crate::dbus::gnome_shell_introspect::{self, IntrospectToNiri, NiriToIntrospect};
|
||||
#[cfg(feature = "dbus")]
|
||||
use crate::dbus::gnome_shell_screenshot::{NiriToScreenshot, ScreenshotToNiri};
|
||||
@@ -726,6 +728,8 @@ impl State {
|
||||
self.niri.notified_activity_this_iteration = false;
|
||||
}
|
||||
|
||||
// We monitor both libinput and logind: libinput is always there (including without DBus), but
|
||||
// it misses some switch events (e.g. after unsuspend) on some systems.
|
||||
pub fn set_lid_closed(&mut self, is_closed: bool) {
|
||||
if self.niri.is_lid_closed == is_closed {
|
||||
return;
|
||||
@@ -2298,6 +2302,14 @@ impl State {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "dbus")]
|
||||
pub fn on_login1_msg(&mut self, msg: Login1ToNiri) {
|
||||
let Login1ToNiri::LidClosedChanged(is_closed) = msg;
|
||||
|
||||
trace!("login1 lid {}", if is_closed { "closed" } else { "opened" });
|
||||
self.set_lid_closed(is_closed);
|
||||
}
|
||||
|
||||
#[cfg(feature = "dbus")]
|
||||
pub fn on_locale1_msg(&mut self, msg: Locale1ToNiri) {
|
||||
let Locale1ToNiri::XkbChanged(xkb) = msg;
|
||||
|
||||
Reference in New Issue
Block a user