mirror of
https://github.com/nekename/OpenDeck.git
synced 2026-10-28 09:44:01 +00:00
fix: correctly wake Stream Deck + after system resume (#420)
This commit is contained in:
1 parent
7cc07942ef
commit
69401d01b3
2 files changed
+13
No files matched your search
@@ -1,3 +1,4 @@
|
|||||||
|
use crate::device_sleep::is_device_sleeping;
|
||||||
use crate::encoder_layouts::generate_encoder_image;
|
use crate::encoder_layouts::generate_encoder_image;
|
||||||
use crate::events::inbound;
|
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) {
|
async fn init(device: AsyncStreamDeck, device_id: String) {
|
||||||
if ELGATO_DEVICES.read().await.contains_key(&device_id) {
|
if ELGATO_DEVICES.read().await.contains_key(&device_id) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ pub fn init_power_events() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
PowerState::Resume => {
|
PowerState::Resume => {
|
||||||
|
tauri::async_runtime::spawn(async {
|
||||||
|
crate::elgato::wake_deeply_sleeping_devices().await;
|
||||||
|
});
|
||||||
tauri::async_runtime::spawn(async {
|
tauri::async_runtime::spawn(async {
|
||||||
if let Err(error) = crate::events::outbound::misc::system_did_wake_up().await {
|
if let Err(error) = crate::events::outbound::misc::system_did_wake_up().await {
|
||||||
log::error!("Failed to send the systemDidWakeUp event: {error}");
|
log::error!("Failed to send the systemDidWakeUp event: {error}");
|
||||||
|
|||||||
Reference in new issue
Block a user