From b5eafc6b9678dd70ef0387f38fc52bc35014a615 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 26 Jul 2024 16:00:15 -0700 Subject: [PATCH] fix(borders): maximize compat w/ komorebi impl This commit ensures that the "Komorebi" border implementation is set as the default as it has the maximum range of compat across different Windows versions, whereas the "Windows" implementation requires Win 11. Because "Windows" implementation methods will error on Windows 10, restore_all_windows has been updated to only attempt to remove accents if BorderImplementation::Windows is selected (this is gated behind the WINDOWS_11 check). re #925 --- komorebi/src/border_manager/mod.rs | 2 +- komorebi/src/static_config.rs | 2 +- komorebi/src/window_manager.rs | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/komorebi/src/border_manager/mod.rs b/komorebi/src/border_manager/mod.rs index f59deebf..cfe125dd 100644 --- a/komorebi/src/border_manager/mod.rs +++ b/komorebi/src/border_manager/mod.rs @@ -43,7 +43,7 @@ lazy_static! { pub static ref Z_ORDER: AtomicCell = AtomicCell::new(ZOrder::Bottom); pub static ref STYLE: AtomicCell = AtomicCell::new(BorderStyle::System); pub static ref IMPLEMENTATION: AtomicCell = - AtomicCell::new(BorderImplementation::Windows); + AtomicCell::new(BorderImplementation::Komorebi); pub static ref FOCUSED: AtomicU32 = AtomicU32::new(u32::from(Colour::Rgb(Rgb::new(66, 165, 245)))); pub static ref UNFOCUSED: AtomicU32 = diff --git a/komorebi/src/static_config.rs b/komorebi/src/static_config.rs index 65483aae..26c47815 100644 --- a/komorebi/src/static_config.rs +++ b/komorebi/src/static_config.rs @@ -300,7 +300,7 @@ pub struct StaticConfig { /// Active window border z-order (default: System) #[serde(skip_serializing_if = "Option::is_none")] pub border_z_order: Option, - /// Display an active window border (default: false) + /// Active window border implementation (default: Komorebi) #[serde(skip_serializing_if = "Option::is_none")] pub border_implementation: Option, /// Add transparency to unfocused windows (default: false) diff --git a/komorebi/src/window_manager.rs b/komorebi/src/window_manager.rs index 61d3a6b6..8044f477 100644 --- a/komorebi/src/window_manager.rs +++ b/komorebi/src/window_manager.rs @@ -26,6 +26,7 @@ use crate::core::config_generation::MatchingRule; use crate::core::custom_layout::CustomLayout; use crate::core::Arrangement; use crate::core::Axis; +use crate::core::BorderImplementation; use crate::core::BorderStyle; use crate::core::CycleDirection; use crate::core::DefaultLayout; @@ -953,6 +954,7 @@ impl WindowManager { let no_titlebar = NO_TITLEBAR.lock(); let known_transparent_hwnds = transparency_manager::known_hwnds(); + let border_implementation = border_manager::IMPLEMENTATION.load(); for monitor in self.monitors_mut() { for workspace in monitor.workspaces_mut() { @@ -966,7 +968,9 @@ impl WindowManager { window.opaque()?; } - window.remove_accent()?; + if matches!(border_implementation, BorderImplementation::Windows) { + window.remove_accent()?; + } window.restore(); }