From 780635c8efba7be917690be522c4597176cfd728 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Wed, 24 Jul 2024 10:37:40 -0700 Subject: [PATCH] fix(transparency): handle multi-monitor monocles This commit ensures that transparency will be set accordingly when focus moves to and from monocle containers on multi-monitor setups. --- komorebi/src/transparency_manager.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/komorebi/src/transparency_manager.rs b/komorebi/src/transparency_manager.rs index 7997d3c4..23248406 100644 --- a/komorebi/src/transparency_manager.rs +++ b/komorebi/src/transparency_manager.rs @@ -104,9 +104,20 @@ pub fn handle_notifications(wm: Arc>) -> color_eyre::Result // Monocle container is never transparent if let Some(monocle) = ws.monocle_container() { if let Some(window) = monocle.focused_window() { - if let Err(error) = window.opaque() { - let hwnd = window.hwnd; - tracing::error!("failed to make monocle window {hwnd} opaque: {error}") + if monitor_idx == focused_monitor_idx { + if let Err(error) = window.opaque() { + let hwnd = window.hwnd; + tracing::error!( + "failed to make monocle window {hwnd} opaque: {error}" + ) + } + } else { + if let Err(error) = window.transparent() { + let hwnd = window.hwnd; + tracing::error!( + "failed to make monocle window {hwnd} transparent: {error}" + ) + } } }