cosmic-session/src/service.rs

26 lines
520 B
Rust
Raw Normal View History

// SPDX-License-Identifier: GPL-3.0-only
use tokio::sync::mpsc;
use zbus::interface;
pub enum SessionRequest {
Exit,
Restart,
}
pub struct SessionService {
pub session_tx: mpsc::Sender<SessionRequest>,
}
#[interface(name = "com.system76.CosmicSession")]
impl SessionService {
async fn exit(&mut self) {
warn!("exiting session");
_ = self.session_tx.send(SessionRequest::Exit).await;
}
2022-07-25 12:34:21 -04:00
async fn restart(&self) {
2022-07-25 12:34:21 -04:00
warn!("restarting session");
_ = self.session_tx.send(SessionRequest::Restart).await;
2022-07-25 12:34:21 -04:00
}
}