From 821b431973fbc1ce2fae1c2a347eadbbae833246 Mon Sep 17 00:00:00 2001 From: "Anthony T. Lannutti" Date: Mon, 15 Jun 2026 00:30:35 -0500 Subject: [PATCH] feat: separate logind feature from systemd Move logind-zbus to a dedicated 'logind' feature that is independent of the 'systemd' feature. This allows non-systemd users (e.g., OpenRC with elogind) to access lid switch inhibition and lid status detection without requiring the full systemd stack. The 'systemd' feature now depends on 'logind' to maintain backward compatibility, so existing users are unaffected. Feature configuration: - default: ["systemd"] - logind: ["logind-zbus"] - systemd: ["libsystemd", "logind", "tracing-journald"] Resolves #2473 Coding-Agent: OpenCode Model: claude-sonnet-4-5 --- Cargo.toml | 3 ++- src/dbus/mod.rs | 2 +- src/input/mod.rs | 2 +- src/state.rs | 8 ++++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0d98c8c1..56b9e2c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -117,7 +117,8 @@ optional = true [features] debug = ["egui", "egui_plot", "smithay-egui", "anyhow/backtrace"] default = ["systemd"] -systemd = ["libsystemd", "logind-zbus"] +logind = ["logind-zbus"] +systemd = ["libsystemd", "logind"] profile-with-tracy = ["profiling/profile-with-tracy", "tracy-client/default"] profile-with-tracy-gpu = ["profile-with-tracy", "smithay/tracy_gpu_profiling"] diff --git a/src/dbus/mod.rs b/src/dbus/mod.rs index e2da75c3..5b9754c3 100644 --- a/src/dbus/mod.rs +++ b/src/dbus/mod.rs @@ -14,7 +14,7 @@ use tracing::{error, warn}; pub mod a11y_keyboard_monitor; use a11y_keyboard_monitor::A11yKeyboardMonitorState; -#[cfg(feature = "systemd")] +#[cfg(feature = "logind")] pub mod logind; mod name_owners; mod power; diff --git a/src/input/mod.rs b/src/input/mod.rs index 519c54d0..a2863d09 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -1600,7 +1600,7 @@ impl State { } InputEvent::Special(_) => {} InputEvent::SwitchToggle { event } => { - #[cfg(feature = "systemd")] + #[cfg(feature = "logind")] if event.switch() == Some(Switch::Lid) && self.common.inhibit_lid_fd.is_some() { let backend = self.backend.lock(); let output = backend diff --git a/src/state.rs b/src/state.rs index 26edade4..5b84492f 100644 --- a/src/state.rs +++ b/src/state.rs @@ -116,7 +116,7 @@ use smithay::{ }; use tracing::warn; -#[cfg(feature = "systemd")] +#[cfg(feature = "logind")] use std::os::fd::OwnedFd; use std::{ @@ -292,7 +292,7 @@ pub struct Common { pub xwayland_shell_state: XWaylandShellState, pub pointer_focus_state: Option, - #[cfg(feature = "systemd")] + #[cfg(feature = "logind")] pub inhibit_lid_fd: Option, pub with_xwayland: bool, @@ -791,7 +791,7 @@ impl State { pointer_focus_state: None, dbus_state, - #[cfg(feature = "systemd")] + #[cfg(feature = "logind")] inhibit_lid_fd: None, with_xwayland, @@ -816,7 +816,7 @@ impl State { } fn update_inhibitor_locks(&mut self) { - #[cfg(feature = "systemd")] + #[cfg(feature = "logind")] { use smithay::backend::session::Session; use tracing::{debug, error, warn};