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
This commit is contained in:
parent
dddf51b441
commit
821b431973
4 changed files with 8 additions and 7 deletions
|
|
@ -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"]
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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<PointerFocusState>,
|
||||
|
||||
#[cfg(feature = "systemd")]
|
||||
#[cfg(feature = "logind")]
|
||||
pub inhibit_lid_fd: Option<OwnedFd>,
|
||||
|
||||
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};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue