Update time when resuming from sleep

This commit is contained in:
Jason Rodney Hansen 2025-06-04 11:03:07 -06:00 committed by Jeremy Soller
parent b38bcd296a
commit 046f805084

View file

@ -9,7 +9,7 @@ use logind_zbus::{
use std::{any::TypeId, error::Error, os::fd::OwnedFd, sync::Arc, time::Duration}; use std::{any::TypeId, error::Error, os::fd::OwnedFd, sync::Arc, time::Duration};
use zbus::Connection; use zbus::Connection;
use crate::locker::Message; use crate::{common, locker::Message};
pub async fn power_off() -> zbus::Result<()> { pub async fn power_off() -> zbus::Result<()> {
let connection = Connection::system().await?; let connection = Connection::system().await?;
@ -99,6 +99,8 @@ pub async fn handler(msg_tx: &mut mpsc::Sender<Message>) -> Result<(), Box<dyn E
if inhibit_opt.is_none() { if inhibit_opt.is_none() {
inhibit_opt = Some(inhibit(&manager).await?); inhibit_opt = Some(inhibit(&manager).await?);
} }
// Immediately update time when resuming from sleep.
msg_tx.send(Message::Common(common::Message::Tick)).await?;
} }
}, },
Err(err) => { Err(err) => {