From 9c8a63928269a6a3b380dd0f5a3ff5eb64a0ac7d Mon Sep 17 00:00:00 2001 From: alex-ds13 <145657253+alex-ds13@users.noreply.github.com> Date: Thu, 13 Feb 2025 11:28:42 +0000 Subject: [PATCH] fix(wm): check for monitor changes on system resume --- komorebi/src/monitor_reconciliator/mod.rs | 31 +++++++++++------------ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/komorebi/src/monitor_reconciliator/mod.rs b/komorebi/src/monitor_reconciliator/mod.rs index 72a08251..fff01d1d 100644 --- a/komorebi/src/monitor_reconciliator/mod.rs +++ b/komorebi/src/monitor_reconciliator/mod.rs @@ -136,21 +136,19 @@ pub fn handle_notifications(wm: Arc>) -> color_eyre::Result let receiver = event_rx(); 'receiver: for notification in receiver { - if !ACTIVE.load_consume() { - if matches!( + if !ACTIVE.load_consume() + && matches!( notification, MonitorNotification::ResumingFromSuspendedState | MonitorNotification::SessionUnlocked - ) { - tracing::debug!( - "reactivating reconciliator - system has resumed from suspended state or session has been unlocked" - ); + ) + { + tracing::debug!( + "reactivating reconciliator - system has resumed from suspended state or session has been unlocked" + ); - ACTIVE.store(true, Ordering::SeqCst); - border_manager::send_notification(None); - } - - continue 'receiver; + ACTIVE.store(true, Ordering::SeqCst); + border_manager::send_notification(None); } let mut wm = wm.lock(); @@ -164,10 +162,6 @@ pub fn handle_notifications(wm: Arc>) -> color_eyre::Result ); ACTIVE.store(false, Ordering::SeqCst); } - MonitorNotification::ResumingFromSuspendedState - | MonitorNotification::SessionUnlocked => { - // this is only handled above if the reconciliator is paused - } MonitorNotification::WorkAreaChanged => { tracing::debug!("handling work area changed notification"); let offset = wm.work_area_offset; @@ -247,7 +241,12 @@ pub fn handle_notifications(wm: Arc>) -> color_eyre::Result } } } - MonitorNotification::DisplayConnectionChange => { + // this is handled above if the reconciliator is paused but we should still check if + // there were any changes to the connected monitors while the system was + // suspended/locked. + MonitorNotification::ResumingFromSuspendedState + | MonitorNotification::SessionUnlocked + | MonitorNotification::DisplayConnectionChange => { tracing::debug!("handling display connection change notification"); let mut monitor_cache = MONITOR_CACHE .get_or_init(|| Mutex::new(HashMap::new()))