mirror of
https://github.com/nekename/OpenDeck.git
synced 2026-10-28 09:44:01 +00:00
feat: implement the systemDidWakeUp event
This commit is contained in:
3 files changed
+21
-1
No files matched your search
@@ -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
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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 => {}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user