diff --git a/komorebi/src/border_manager/border.rs b/komorebi/src/border_manager/border.rs index 49500a11..d8f12271 100644 --- a/komorebi/src/border_manager/border.rs +++ b/komorebi/src/border_manager/border.rs @@ -6,6 +6,7 @@ use crate::accessibility::notification_constants::kAXMainWindowChangedNotificati use crate::accessibility::notification_constants::kAXWindowMovedNotification; use crate::accessibility::notification_constants::kAXWindowResizedNotification; use crate::border_manager::BORDER_OFFSET; +use crate::border_manager::BORDER_OFFSET_ADJUSTMENT; use crate::border_manager::BORDER_WIDTH; use crate::border_manager::ns_window::NsWindow; use crate::border_manager::window_kind_colour; @@ -56,7 +57,8 @@ unsafe extern "C-unwind" fn border_observer_callback( rect.size, ); - let offset = BORDER_OFFSET.load(Ordering::Relaxed) as f64; + let offset = + BORDER_OFFSET.load(Ordering::Relaxed) as f64 + BORDER_OFFSET_ADJUSTMENT as f64; ns_rect.origin.x -= offset; ns_rect.origin.y -= offset; diff --git a/komorebi/src/border_manager/mod.rs b/komorebi/src/border_manager/mod.rs index 748323cc..caf088b5 100644 --- a/komorebi/src/border_manager/mod.rs +++ b/komorebi/src/border_manager/mod.rs @@ -29,11 +29,19 @@ use std::sync::atomic::AtomicI32; use std::sync::atomic::AtomicU32; use std::sync::atomic::Ordering; -pub static BORDER_WIDTH: AtomicI32 = AtomicI32::new(6); -pub static BORDER_OFFSET: AtomicI32 = AtomicI32::new(5); +pub static BORDER_WIDTH: AtomicI32 = AtomicI32::new(10); +pub static BORDER_OFFSET: AtomicI32 = AtomicI32::new(0); pub static BORDER_RADIUS: AtomicI32 = AtomicI32::new(10); pub static BORDER_ENABLED: AtomicBool = AtomicBool::new(true); +// Windows has a 7px invisible border around every app which the border_x +// config options have to take into account. In order to keep the komorebi +// configuration truly portable across Windows and macOS, we need to add +// that same 7px adjustment to whatever BORDER_OFFSET is set to. I hate this, +// but config compatibility has to come first, and komorebi for Windows already +// has tens of thousands of users. +pub static BORDER_OFFSET_ADJUSTMENT: i32 = 7; + lazy_static! { pub static ref FOCUSED: AtomicU32 = AtomicU32::new(u32::from(Colour::Rgb(Rgb::new(66, 165, 245)))); diff --git a/komorebi/src/border_manager/ns_window.rs b/komorebi/src/border_manager/ns_window.rs index dee7d339..ddacd5bd 100644 --- a/komorebi/src/border_manager/ns_window.rs +++ b/komorebi/src/border_manager/ns_window.rs @@ -1,4 +1,5 @@ use crate::border_manager::BORDER_OFFSET; +use crate::border_manager::BORDER_OFFSET_ADJUSTMENT; use crate::border_manager::BORDER_RADIUS; use crate::border_manager::BORDER_WIDTH; use color_eyre::eyre; @@ -38,7 +39,7 @@ unsafe impl Send for NsWindow {} impl NsWindow { pub fn new(ns_rect: NSRect, target_window_id: u32) -> eyre::Result { - let offset = BORDER_OFFSET.load(Ordering::Relaxed) as f64; + let offset = BORDER_OFFSET.load(Ordering::Relaxed) as f64 + BORDER_OFFSET_ADJUSTMENT as f64; let mut ns_rect = ns_rect; diff --git a/nix/komorebi-bar-options.nix b/nix/komorebi-bar-options.nix index 38a1bc7c..07c09c14 100644 --- a/nix/komorebi-bar-options.nix +++ b/nix/komorebi-bar-options.nix @@ -965,6 +965,103 @@ in ] ); }; + auto_select_text = lib.mkOption { + type = ( + lib.types.nullOr ( + lib.types.oneOf [ + (lib.types.nullOr catppuccinValue) + (lib.types.nullOr base16Value) + ] + ) + ); + default = null; + }; + colours = lib.mkOption { + type = ( + lib.types.nullOr ( + lib.types.submodule { + options = { + base_00 = lib.mkOption { + type = colour; + description = "Base00"; + }; + base_01 = lib.mkOption { + type = colour; + description = "Base01"; + }; + base_02 = lib.mkOption { + type = colour; + description = "Base02"; + }; + base_03 = lib.mkOption { + type = colour; + description = "Base03"; + }; + base_04 = lib.mkOption { + type = colour; + description = "Base04"; + }; + base_05 = lib.mkOption { + type = colour; + description = "Base05"; + }; + base_06 = lib.mkOption { + type = colour; + description = "Base06"; + }; + base_07 = lib.mkOption { + type = colour; + description = "Base07"; + }; + base_08 = lib.mkOption { + type = colour; + description = "Base08"; + }; + base_09 = lib.mkOption { + type = colour; + description = "Base09"; + }; + base_0a = lib.mkOption { + type = colour; + description = "Base0A"; + }; + base_0b = lib.mkOption { + type = colour; + description = "Base0B"; + }; + base_0c = lib.mkOption { + type = colour; + description = "Base0C"; + }; + base_0d = lib.mkOption { + type = colour; + description = "Base0D"; + }; + base_0e = lib.mkOption { + type = colour; + description = "Base0E"; + }; + base_0f = lib.mkOption { + type = colour; + description = "Base0F"; + }; + }; + } + ) + ); + default = null; + }; + accent = lib.mkOption { + type = ( + lib.types.nullOr ( + lib.types.oneOf [ + (lib.types.nullOr catppuccinValue) + (lib.types.nullOr base16Value) + ] + ) + ); + default = null; + }; name = lib.mkOption { type = ( lib.types.nullOr ( @@ -1251,17 +1348,6 @@ in ); default = null; }; - auto_select_text = lib.mkOption { - type = ( - lib.types.nullOr ( - lib.types.oneOf [ - (lib.types.nullOr catppuccinValue) - (lib.types.nullOr base16Value) - ] - ) - ); - default = null; - }; auto_select_fill = lib.mkOption { type = ( lib.types.nullOr ( @@ -1273,92 +1359,6 @@ in ); default = null; }; - colours = lib.mkOption { - type = ( - lib.types.nullOr ( - lib.types.submodule { - options = { - base_00 = lib.mkOption { - type = colour; - description = "Base00"; - }; - base_01 = lib.mkOption { - type = colour; - description = "Base01"; - }; - base_02 = lib.mkOption { - type = colour; - description = "Base02"; - }; - base_03 = lib.mkOption { - type = colour; - description = "Base03"; - }; - base_04 = lib.mkOption { - type = colour; - description = "Base04"; - }; - base_05 = lib.mkOption { - type = colour; - description = "Base05"; - }; - base_06 = lib.mkOption { - type = colour; - description = "Base06"; - }; - base_07 = lib.mkOption { - type = colour; - description = "Base07"; - }; - base_08 = lib.mkOption { - type = colour; - description = "Base08"; - }; - base_09 = lib.mkOption { - type = colour; - description = "Base09"; - }; - base_0a = lib.mkOption { - type = colour; - description = "Base0A"; - }; - base_0b = lib.mkOption { - type = colour; - description = "Base0B"; - }; - base_0c = lib.mkOption { - type = colour; - description = "Base0C"; - }; - base_0d = lib.mkOption { - type = colour; - description = "Base0D"; - }; - base_0e = lib.mkOption { - type = colour; - description = "Base0E"; - }; - base_0f = lib.mkOption { - type = colour; - description = "Base0F"; - }; - }; - } - ) - ); - default = null; - }; - accent = lib.mkOption { - type = ( - lib.types.nullOr ( - lib.types.oneOf [ - (lib.types.nullOr catppuccinValue) - (lib.types.nullOr base16Value) - ] - ) - ); - default = null; - }; }; } ) diff --git a/nix/komorebi-options.nix b/nix/komorebi-options.nix index fbf0b177..23163b79 100644 --- a/nix/komorebi-options.nix +++ b/nix/komorebi-options.nix @@ -427,7 +427,7 @@ in }; border_offset = lib.mkOption { type = (lib.types.nullOr lib.types.int); - default = 5; + default = 0; description = "Offset of window borders"; }; border_radius = lib.mkOption { @@ -437,7 +437,7 @@ in }; border_width = lib.mkOption { type = (lib.types.nullOr lib.types.int); - default = 6; + default = 10; description = "Width of window borders"; }; cross_boundary_behaviour = lib.mkOption { @@ -778,82 +778,7 @@ in ] ); }; - colours = lib.mkOption { - type = ( - lib.types.nullOr ( - lib.types.submodule { - options = { - base_00 = lib.mkOption { - type = colour; - description = "Base00"; - }; - base_01 = lib.mkOption { - type = colour; - description = "Base01"; - }; - base_02 = lib.mkOption { - type = colour; - description = "Base02"; - }; - base_03 = lib.mkOption { - type = colour; - description = "Base03"; - }; - base_04 = lib.mkOption { - type = colour; - description = "Base04"; - }; - base_05 = lib.mkOption { - type = colour; - description = "Base05"; - }; - base_06 = lib.mkOption { - type = colour; - description = "Base06"; - }; - base_07 = lib.mkOption { - type = colour; - description = "Base07"; - }; - base_08 = lib.mkOption { - type = colour; - description = "Base08"; - }; - base_09 = lib.mkOption { - type = colour; - description = "Base09"; - }; - base_0a = lib.mkOption { - type = colour; - description = "Base0A"; - }; - base_0b = lib.mkOption { - type = colour; - description = "Base0B"; - }; - base_0c = lib.mkOption { - type = colour; - description = "Base0C"; - }; - base_0d = lib.mkOption { - type = colour; - description = "Base0D"; - }; - base_0e = lib.mkOption { - type = colour; - description = "Base0E"; - }; - base_0f = lib.mkOption { - type = colour; - description = "Base0F"; - }; - }; - } - ) - ); - default = null; - }; - stack_border = lib.mkOption { + floating_border = lib.mkOption { type = ( lib.types.nullOr ( lib.types.oneOf [ @@ -864,29 +789,7 @@ in ); default = null; }; - unfocused_border = lib.mkOption { - type = ( - lib.types.nullOr ( - lib.types.oneOf [ - (lib.types.nullOr catppuccinValue) - (lib.types.nullOr base16Value) - ] - ) - ); - default = null; - }; - unfocused_locked_border = lib.mkOption { - type = ( - lib.types.nullOr ( - lib.types.oneOf [ - (lib.types.nullOr catppuccinValue) - (lib.types.nullOr base16Value) - ] - ) - ); - default = null; - }; - single_border = lib.mkOption { + bar_accent = lib.mkOption { type = ( lib.types.nullOr ( lib.types.oneOf [ @@ -1183,7 +1086,18 @@ in ); default = null; }; - bar_accent = lib.mkOption { + unfocused_locked_border = lib.mkOption { + type = ( + lib.types.nullOr ( + lib.types.oneOf [ + (lib.types.nullOr catppuccinValue) + (lib.types.nullOr base16Value) + ] + ) + ); + default = null; + }; + stack_border = lib.mkOption { type = ( lib.types.nullOr ( lib.types.oneOf [ @@ -1205,7 +1119,93 @@ in ); default = null; }; - floating_border = lib.mkOption { + single_border = lib.mkOption { + type = ( + lib.types.nullOr ( + lib.types.oneOf [ + (lib.types.nullOr catppuccinValue) + (lib.types.nullOr base16Value) + ] + ) + ); + default = null; + }; + colours = lib.mkOption { + type = ( + lib.types.nullOr ( + lib.types.submodule { + options = { + base_00 = lib.mkOption { + type = colour; + description = "Base00"; + }; + base_01 = lib.mkOption { + type = colour; + description = "Base01"; + }; + base_02 = lib.mkOption { + type = colour; + description = "Base02"; + }; + base_03 = lib.mkOption { + type = colour; + description = "Base03"; + }; + base_04 = lib.mkOption { + type = colour; + description = "Base04"; + }; + base_05 = lib.mkOption { + type = colour; + description = "Base05"; + }; + base_06 = lib.mkOption { + type = colour; + description = "Base06"; + }; + base_07 = lib.mkOption { + type = colour; + description = "Base07"; + }; + base_08 = lib.mkOption { + type = colour; + description = "Base08"; + }; + base_09 = lib.mkOption { + type = colour; + description = "Base09"; + }; + base_0a = lib.mkOption { + type = colour; + description = "Base0A"; + }; + base_0b = lib.mkOption { + type = colour; + description = "Base0B"; + }; + base_0c = lib.mkOption { + type = colour; + description = "Base0C"; + }; + base_0d = lib.mkOption { + type = colour; + description = "Base0D"; + }; + base_0e = lib.mkOption { + type = colour; + description = "Base0E"; + }; + base_0f = lib.mkOption { + type = colour; + description = "Base0F"; + }; + }; + } + ) + ); + default = null; + }; + unfocused_border = lib.mkOption { type = ( lib.types.nullOr ( lib.types.oneOf [ diff --git a/schema.json b/schema.json index c167e0d2..d09c9656 100644 --- a/schema.json +++ b/schema.json @@ -52,7 +52,7 @@ "null" ], "format": "int32", - "default": 5 + "default": 0 }, "border_radius": { "description": "Radius of window borders", @@ -70,7 +70,7 @@ "null" ], "format": "int32", - "default": 6 + "default": 10 }, "cross_boundary_behaviour": { "description": "Determine what happens when an action is called on a window at a monitor boundary",