feat: add systemd notify with feature

This commit is contained in:
Michael Yang 2024-07-06 17:24:33 +10:00 committed by Shawn Wallace
parent d32eae139d
commit d8bfa0a1a3
3 changed files with 16 additions and 0 deletions

7
Cargo.lock generated
View file

@ -464,6 +464,12 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
[[package]]
name = "sd-notify"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4646d6f919800cd25c50edb49438a1381e2cd4833c027e75e8897981c50b8b5e"
[[package]] [[package]]
name = "shlex" name = "shlex"
version = "1.3.0" version = "1.3.0"
@ -856,6 +862,7 @@ dependencies = [
"paste", "paste",
"pretty_env_logger", "pretty_env_logger",
"rustix", "rustix",
"sd-notify",
"slotmap", "slotmap",
"smithay-client-toolkit", "smithay-client-toolkit",
"testwl", "testwl",

View file

@ -34,6 +34,12 @@ slotmap = "1.0.7"
xcb-util-cursor = "0.3.2" xcb-util-cursor = "0.3.2"
smithay-client-toolkit = { version = "0.19.1", default-features = false } smithay-client-toolkit = { version = "0.19.1", default-features = false }
sd-notify = { version = "0.4.2", optional = true }
[features]
default = []
systemd = ["dep:sd-notify"]
[dev-dependencies] [dev-dependencies]
rustix = { workspace = true, features = ["fs"] } rustix = { workspace = true, features = ["fs"] }
testwl = { path = "testwl" } testwl = { path = "testwl" }

View file

@ -158,6 +158,9 @@ pub fn main(data: impl RunData) -> Option<()> {
data.xwayland_ready(display); data.xwayland_ready(display);
server_state.set_x_connection(xstate.connection.clone()); server_state.set_x_connection(xstate.connection.clone());
server_state.atoms = Some(xstate.atoms.clone()); server_state.atoms = Some(xstate.atoms.clone());
#[cfg(feature = "systemd")]
let _ = sd_notify::notify(true, &[sd_notify::NotifyState::Ready]);
} }
if let Some(xstate) = &mut xstate { if let Some(xstate) = &mut xstate {