Skip to content

Commit

Permalink
fix(borders): maximize compat w/ komorebi impl
Browse files Browse the repository at this point in the history
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
  • Loading branch information
LGUG2Z committed Jul 26, 2024
1 parent c367967 commit b5eafc6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion komorebi/src/border_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ lazy_static! {
pub static ref Z_ORDER: AtomicCell<ZOrder> = AtomicCell::new(ZOrder::Bottom);
pub static ref STYLE: AtomicCell<BorderStyle> = AtomicCell::new(BorderStyle::System);
pub static ref IMPLEMENTATION: AtomicCell<BorderImplementation> =
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 =
Expand Down
2 changes: 1 addition & 1 deletion komorebi/src/static_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ZOrder>,
/// Display an active window border (default: false)
/// Active window border implementation (default: Komorebi)
#[serde(skip_serializing_if = "Option::is_none")]
pub border_implementation: Option<BorderImplementation>,
/// Add transparency to unfocused windows (default: false)
Expand Down
6 changes: 5 additions & 1 deletion komorebi/src/window_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand All @@ -966,7 +968,9 @@ impl WindowManager {
window.opaque()?;
}

window.remove_accent()?;
if matches!(border_implementation, BorderImplementation::Windows) {
window.remove_accent()?;
}

window.restore();
}
Expand Down

0 comments on commit b5eafc6

Please sign in to comment.