fix: correctly wake Stream Deck + after system resume (#420)

This commit is contained in:
Nicolas Craig Rossi authored and GitHub committed 2026-10-03 17:18:53 +01:00
1 parent 7cc07942ef
commit 69401d01b3
2 files changed
+13

No files matched your search

+10
View File
@@ -1,3 +1,4 @@
use crate::device_sleep::is_device_sleeping;
use crate::encoder_layouts::generate_encoder_image;
use crate::events::inbound;
@@ -129,6 +130,15 @@ pub async fn reset_devices() {
}
}
/// Wake up certain kinds of devices that do not wake themselves after the computer resumes from sleep.
pub async fn wake_deeply_sleeping_devices() {
for (id, device) in ELGATO_DEVICES.read().await.iter() {
if device.kind() == Kind::Plus && !is_device_sleeping(id) {
set_brightness(id, crate::store::get_settings().value.brightness).await;
}
}
}
async fn init(device: AsyncStreamDeck, device_id: String) {
if ELGATO_DEVICES.read().await.contains_key(&device_id) {
return;
+3
View File
@@ -26,6 +26,9 @@ pub fn init_power_events() {
});
}
PowerState::Resume => {
tauri::async_runtime::spawn(async {
crate::elgato::wake_deeply_sleeping_devices().await;
});
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}");