feat: implement the systemDidWakeUp event

This commit is contained in:
nekename committed 2026-06-22 11:37:24 +01:00
1 parent d9ff9f8734
commit b9e47358a7
3 files changed
+21 -1

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
use super::send_to_all_plugins;
use serde::Serialize;
#[derive(Serialize)]
struct SystemDidWakeUpEvent {
event: &'static str,
}
pub async fn system_did_wake_up() -> Result<(), anyhow::Error> {
send_to_all_plugins(&SystemDidWakeUpEvent { event: "systemDidWakeUp" }).await
}
+1
View File
@@ -3,6 +3,7 @@ pub mod deep_link;
pub mod devices;
pub mod encoder;
pub mod keypad;
pub mod misc;
pub mod property_inspector;
pub mod settings;
pub mod states;
+8 -1
View File
@@ -25,7 +25,14 @@ pub fn init_power_events() {
}
});
}
PowerState::Suspend | PowerState::Resume | PowerState::Shutdown | PowerState::Unknown => {}
PowerState::Resume => {
tauri::async_runtime::spawn(async {
if let Err(error) = crate::events::outbound::misc::system_did_wake_up().await {
log::error!("Failed to send the systemDidWakeUp event: {error}");
}
});
}
PowerState::Suspend | PowerState::Shutdown | PowerState::Unknown => {}
}
}
});