diff --git a/src/logind.rs b/src/logind.rs index 912e10e..44f24da 100644 --- a/src/logind.rs +++ b/src/logind.rs @@ -6,7 +6,7 @@ use logind_zbus::{ manager::{InhibitType, ManagerProxy}, session::SessionProxy, }; -use std::{any::TypeId, error::Error, os::fd::OwnedFd, process, sync::Arc}; +use std::{any::TypeId, error::Error, os::fd::OwnedFd, sync::Arc}; use tokio::time; use zbus::Connection; @@ -68,7 +68,7 @@ pub fn subscription() -> Subscription { pub async fn handler(msg_tx: &mut mpsc::Sender) -> Result<(), Box> { let connection = Connection::system().await?; let manager = ManagerProxy::new(&connection).await?; - let session_path = manager.get_session_by_PID(process::id()).await?; + let session_path = manager.get_session_by_PID(std::os::unix::process::parent_id()).await?; let session = SessionProxy::builder(&connection) .path(&session_path)? .build()