diff --git a/docs/cli/active-window-border-colour.md b/docs/cli/active-window-border-colour.md deleted file mode 100644 index 9a62b927..00000000 --- a/docs/cli/active-window-border-colour.md +++ /dev/null @@ -1,26 +0,0 @@ -# active-window-border-colour - -``` -Set the colour for the active window border - -Usage: komorebic.exe active-window-border-colour [OPTIONS] - -Arguments: - - Red - - - Green - - - Blue - -Options: - -w, --window-kind - [default: single] - [possible values: single, stack, monocle] - - -h, --help - Print help - -``` diff --git a/docs/cli/active-window-border-offset.md b/docs/cli/active-window-border-offset.md deleted file mode 100644 index a40db30a..00000000 --- a/docs/cli/active-window-border-offset.md +++ /dev/null @@ -1,16 +0,0 @@ -# active-window-border-offset - -``` -Set the offset for the active window border - -Usage: komorebic.exe active-window-border-offset - -Arguments: - - Desired offset of the active window border - -Options: - -h, --help - Print help - -``` diff --git a/docs/cli/active-window-border-width.md b/docs/cli/active-window-border-width.md deleted file mode 100644 index 28001bdf..00000000 --- a/docs/cli/active-window-border-width.md +++ /dev/null @@ -1,16 +0,0 @@ -# active-window-border-width - -``` -Set the width for the active window border - -Usage: komorebic.exe active-window-border-width - -Arguments: - - Desired width of the active window border - -Options: - -h, --help - Print help - -``` diff --git a/docs/cli/border-colour.md b/docs/cli/border-colour.md new file mode 100644 index 00000000..0bf59f10 --- /dev/null +++ b/docs/cli/border-colour.md @@ -0,0 +1,26 @@ +# border-colour + +``` +Set the colour for a window border kind + +Usage: komorebic.exe border-colour [OPTIONS] + +Arguments: + + Red + + + Green + + + Blue + +Options: + -w, --window-kind + [default: single] + [possible values: single, stack, monocle, unfocused] + + -h, --help + Print help + +``` diff --git a/docs/cli/border-offset.md b/docs/cli/border-offset.md new file mode 100644 index 00000000..ed3b7675 --- /dev/null +++ b/docs/cli/border-offset.md @@ -0,0 +1,16 @@ +# border-offset + +``` +Set the border offset + +Usage: komorebic.exe border-offset + +Arguments: + + Desired offset of the window border + +Options: + -h, --help + Print help + +``` diff --git a/docs/cli/border-width.md b/docs/cli/border-width.md new file mode 100644 index 00000000..bc32b2e9 --- /dev/null +++ b/docs/cli/border-width.md @@ -0,0 +1,16 @@ +# border-width + +``` +Set the border width + +Usage: komorebic.exe border-width + +Arguments: + + Desired width of the window border + +Options: + -h, --help + Print help + +``` diff --git a/docs/cli/active-window-border.md b/docs/cli/border.md similarity index 51% rename from docs/cli/active-window-border.md rename to docs/cli/border.md index 405c3688..3f971634 100644 --- a/docs/cli/active-window-border.md +++ b/docs/cli/border.md @@ -1,9 +1,9 @@ -# active-window-border +# border ``` -Enable or disable the active window border +Enable or disable borders -Usage: komorebic.exe active-window-border +Usage: komorebic.exe border Arguments: diff --git a/docs/cli/cross-monitor-move-behaviour.md b/docs/cli/cross-monitor-move-behaviour.md index 2a868c44..5b8530e6 100644 --- a/docs/cli/cross-monitor-move-behaviour.md +++ b/docs/cli/cross-monitor-move-behaviour.md @@ -10,6 +10,7 @@ Arguments: Possible values: - swap: Swap the window container with the window container at the edge of the adjacent monitor - insert: Insert the window container into the focused workspace on the adjacent monitor + - no-op: Do nothing if trying to move a window container in the direction of an adjacent monitor Options: -h, --help diff --git a/docs/common-workflows/active-window-border.md b/docs/common-workflows/active-window-border.md deleted file mode 100644 index d02cf854..00000000 --- a/docs/common-workflows/active-window-border.md +++ /dev/null @@ -1,39 +0,0 @@ -# Active Window Border - -If you would like to add a visual border around the currently focused window, -ensure the following options are defined in the `komorebi.json` configuration -file. - -```json -{ - "active_window_border": true, - "active_window_border_style": "Rounded", - "active_window_border_colours": { - "single": { - "r": 66, - "g": 165, - "b": 245 - }, - "stack": { - "r": 256, - "g": 165, - "b": 66 - }, - "monocle": { - "r": 255, - "g": 51, - "b": 153 - } - }, -} - -``` - -It is important to note that the active window border will only apply to -windows managed by `komorebi`. - -This feature is not considered stable, and you may encounter visual artifacts -from time to time. - -[![Watch the tutorial -video](https://img.youtube.com/vi/7_9D22t7KK4/hqdefault.jpg)](https://www.youtube.com/watch?v=7_9D22t7KK4) diff --git a/docs/common-workflows/autohotkey.md b/docs/common-workflows/autohotkey.md index f7d00f3d..3559f959 100644 --- a/docs/common-workflows/autohotkey.md +++ b/docs/common-workflows/autohotkey.md @@ -1,7 +1,5 @@ # AutoHotKey - - If you would like to use Autohotkey, please make sure you have AutoHotKey v2 installed. @@ -9,19 +7,16 @@ Generally, users who opt for AHK will have specific needs that can only be addressed by the advanced functionality of AHK, and so they are assumed to be able to craft their own configuration files. -If you would like to try out AHK, a simple sample configuration powered by -`komorebic.lib.ahk` is provided as a starting point. This sample configuration -does not take into account the use of a static configuration file; if you -choose to use a static configuration file alongside AHK, you can remove all the -configuration options from your `komorebi.ahk` and use it solely to handle -hotkey bindings. - - -```powershell -# save the latest generated komorebic library to ~/komorebic.lib.ahk -iwr https://raw.githubusercontent.com/LGUG2Z/komorebi/v0.1.20/komorebic.lib.ahk -OutFile $Env:USERPROFILE\komorebic.lib.ahk +If you would like to try out AHK, here is a simple sample configuration which +largely matches the `whkdrc` sample configuration. -# save the sample komorebi configuration file to ~/komorebi.ahk -iwr https://raw.githubusercontent.com/LGUG2Z/komorebi/v0.1.20/komorebi.sample.ahk -OutFile $Env:USERPROFILE\komorebi.ahk ``` +{% include "../komorebi.ahk" %} +``` + +By default, the `komorebi.ahk` file should be located in the `$Env:USERPROFILE` +directory, however, if `$Env:KOMOREBI_CONFIG_HOME` is set, it should be located +there. +Once the file is in place, you can stop komorebi and whkd by running `komorebic stop --whkd`, +and then start komorebi with Autohotkey by running `komorebic start --ahk`. \ No newline at end of file diff --git a/docs/common-workflows/borders.md b/docs/common-workflows/borders.md new file mode 100644 index 00000000..b81e9ddf --- /dev/null +++ b/docs/common-workflows/borders.md @@ -0,0 +1,28 @@ +# Borders + +If you would like to add a visual border around both the currently focused window +and unfocused windows ensure the following options are defined in the `komorebi.json` +configuration file. + +```json +{ + "border": true, + "border_width": 8, + "border_offset": -1, + "border_style": "System", + "border_colours": { + "single": "#42a5f5", + "stack": "#00a542", + "monocle": "#ff3399", + "unfocused": "#808080" + } +} +``` + +It is important to note that borders will only apply to windows managed by `komorebi`. + +This feature is not considered stable, and you may encounter visual artifacts +from time to time. + +[![Watch the tutorial +video](https://img.youtube.com/vi/7_9D22t7KK4/hqdefault.jpg)](https://www.youtube.com/watch?v=7_9D22t7KK4) diff --git a/docs/installation.md b/docs/installation.md index d0a728a0..cc02e168 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -30,10 +30,10 @@ to manipulate the window manager, you use [WinGet](https://winget.run/pkg/LGUG2Z/komorebi), and you may also built it from [source](https://github.com/LGUG2Z/komorebi) if you would prefer. - - [Scoop](#scoop) - - [WinGet](#winget) - - [Building from source](#building-from-source) - - [Offline](#offline) +- [Scoop](#scoop) +- [WinGet](#winget) +- [Building from source](#building-from-source) +- [Offline](#offline) ## Long path support @@ -45,6 +45,12 @@ running the following command in an Administrator Terminal before installing Set-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1 ``` +## Disabling Unnecessary System Animations + +It is highly recommended that you enable the "Turn off all unnecessary animations (when possible)" option in +"Control Panel > Ease of Access > Ease of Access Centre / Make the computer easier to see" for the best performance with +komorebi. + ## Scoop Make sure you have installed [`scoop`](https://scoop.sh) and verified that diff --git a/docs/komorebi.example.json b/docs/komorebi.example.json index 48d1abff..cec8c369 100644 --- a/docs/komorebi.example.json +++ b/docs/komorebi.example.json @@ -5,17 +5,18 @@ "cross_monitor_move_behaviour": "Insert", "default_workspace_padding": 20, "default_container_padding": 20, + "border": true, "border_width": 8, "border_offset": -1, - "active_window_border": false, - "active_window_border_colours": { + "border_colours": { "single": "#42a5f5", "stack": "#00a542", - "monocle": "#ff3399" + "monocle": "#ff3399", + "unfocused": "#808080" }, "stackbar": { "height": 40, - "mode": "Never", + "mode": "OnStack", "tabs": { "width": 300, "focused_text": "#00a542", diff --git a/docs/whkdrc.sample b/docs/whkdrc.sample index 77c6eac7..ad985546 100644 --- a/docs/whkdrc.sample +++ b/docs/whkdrc.sample @@ -10,6 +10,9 @@ alt + shift + o : komorebic reload-configuration # alt + f : if ($wshell.AppActivate('Firefox') -eq $False) { start firefox } # alt + b : if ($wshell.AppActivate('Chrome') -eq $False) { start chrome } +alt + q : komorebic close +alt + m : komorebic minimize + # Focus windows alt + h : komorebic focus left alt + j : komorebic focus down @@ -56,8 +59,18 @@ alt + y : komorebic flip-layout vertical alt + 1 : komorebic focus-workspace 0 alt + 2 : komorebic focus-workspace 1 alt + 3 : komorebic focus-workspace 2 +alt + 4 : komorebic focus-workspace 3 +alt + 5 : komorebic focus-workspace 4 +alt + 6 : komorebic focus-workspace 5 +alt + 7 : komorebic focus-workspace 6 +alt + 8 : komorebic focus-workspace 7 # Move windows across workspaces alt + shift + 1 : komorebic move-to-workspace 0 alt + shift + 2 : komorebic move-to-workspace 1 alt + shift + 3 : komorebic move-to-workspace 2 +alt + shift + 4 : komorebic move-to-workspace 3 +alt + shift + 5 : komorebic move-to-workspace 4 +alt + shift + 6 : komorebic move-to-workspace 5 +alt + shift + 7 : komorebic move-to-workspace 6 +alt + shift + 8 : komorebic move-to-workspace 7 diff --git a/justfile b/justfile index 37d85ca7..d077616f 100644 --- a/justfile +++ b/justfile @@ -16,12 +16,6 @@ fmt: install-target target: cargo +stable install --path {{ target }} --locked -prepare: - komorebic ahk-asc '~/.config/komorebi/applications.yaml' - komorebic pwsh-asc '~/.config/komorebi/applications.yaml' - cat '~/.config/komorebi/komorebi.generated.ps1' >komorebi.generated.ps1 - cat '~/.config/komorebi/komorebi.generated.ahk' >komorebi.generated.ahk - install: just install-target komorebic just install-target komorebic-no-console diff --git a/komorebi-client/src/lib.rs b/komorebi-client/src/lib.rs index 27fb227a..02971a2c 100644 --- a/komorebi-client/src/lib.rs +++ b/komorebi-client/src/lib.rs @@ -9,7 +9,7 @@ pub use komorebi::ring::Ring; pub use komorebi::window::Window; pub use komorebi::window_manager_event::WindowManagerEvent; pub use komorebi::workspace::Workspace; -pub use komorebi::ActiveWindowBorderColours; +pub use komorebi::BorderColours; pub use komorebi::GlobalState; pub use komorebi::Notification; pub use komorebi::NotificationEvent; @@ -18,9 +18,9 @@ pub use komorebi::StackbarConfig; pub use komorebi::State; pub use komorebi::StaticConfig; pub use komorebi::TabsConfig; -pub use komorebi_core::ActiveWindowBorderStyle; pub use komorebi_core::Arrangement; pub use komorebi_core::Axis; +pub use komorebi_core::BorderStyle; pub use komorebi_core::CustomLayout; pub use komorebi_core::CycleDirection; pub use komorebi_core::DefaultLayout; diff --git a/komorebi-core/src/lib.rs b/komorebi-core/src/lib.rs index 38e6203b..c0e979cf 100644 --- a/komorebi-core/src/lib.rs +++ b/komorebi-core/src/lib.rs @@ -130,9 +130,12 @@ pub enum SocketMessage { WatchConfiguration(bool), CompleteConfiguration, AltFocusHack(bool), - ActiveWindowBorder(bool), - ActiveWindowBorderColour(WindowKind, u32, u32, u32), - ActiveWindowBorderStyle(ActiveWindowBorderStyle), + #[serde(alias = "ActiveWindowBorder")] + Border(bool), + #[serde(alias = "ActiveWindowBorderColour")] + BorderColour(WindowKind, u32, u32, u32), + #[serde(alias = "ActiveWindowBorderStyle")] + BorderStyle(BorderStyle), BorderWidth(i32), BorderOffset(i32), InvisibleBorders(Rect), @@ -201,7 +204,7 @@ pub enum StackbarMode { #[derive( Default, Copy, Clone, Debug, Eq, PartialEq, Display, Serialize, Deserialize, JsonSchema, )] -pub enum ActiveWindowBorderStyle { +pub enum BorderStyle { #[default] /// Use the system border style System, diff --git a/komorebi/src/border_manager/border.rs b/komorebi/src/border_manager/border.rs index 882a44be..5e143a8b 100644 --- a/komorebi/src/border_manager/border.rs +++ b/komorebi/src/border_manager/border.rs @@ -12,7 +12,7 @@ use crate::border_manager::Z_ORDER; use crate::WindowsApi; use crate::WINDOWS_11; -use komorebi_core::ActiveWindowBorderStyle; +use komorebi_core::BorderStyle; use komorebi_core::Rect; use std::sync::atomic::Ordering; @@ -195,17 +195,17 @@ impl Border { // wrong size. In the future we should read the DWM properties // of windows and attempt to match appropriately. match *STYLE.lock() { - ActiveWindowBorderStyle::System => { + BorderStyle::System => { if *WINDOWS_11 { RoundRect(hdc, 0, 0, rect.right, rect.bottom, 20, 20); } else { Rectangle(hdc, 0, 0, rect.right, rect.bottom); } } - ActiveWindowBorderStyle::Rounded => { + BorderStyle::Rounded => { RoundRect(hdc, 0, 0, rect.right, rect.bottom, 20, 20); } - ActiveWindowBorderStyle::Square => { + BorderStyle::Square => { Rectangle(hdc, 0, 0, rect.right, rect.bottom); } } diff --git a/komorebi/src/border_manager/mod.rs b/komorebi/src/border_manager/mod.rs index b8896b2a..227c31c0 100644 --- a/komorebi/src/border_manager/mod.rs +++ b/komorebi/src/border_manager/mod.rs @@ -5,7 +5,7 @@ mod border; use crossbeam_channel::Receiver; use crossbeam_channel::Sender; use crossbeam_utils::atomic::AtomicConsume; -use komorebi_core::ActiveWindowBorderStyle; +use komorebi_core::BorderStyle; use lazy_static::lazy_static; use parking_lot::Mutex; use schemars::JsonSchema; @@ -39,8 +39,7 @@ pub static BORDER_ENABLED: AtomicBool = AtomicBool::new(true); lazy_static! { pub static ref Z_ORDER: Arc> = Arc::new(Mutex::new(ZOrder::Bottom)); - pub static ref STYLE: Arc> = - Arc::new(Mutex::new(ActiveWindowBorderStyle::System)); + pub static ref STYLE: Arc> = Arc::new(Mutex::new(BorderStyle::System)); 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/process_command.rs b/komorebi/src/process_command.rs index ca80b243..c813b00a 100644 --- a/komorebi/src/process_command.rs +++ b/komorebi/src/process_command.rs @@ -1205,10 +1205,10 @@ impl WindowManager { SocketMessage::UnmanagedWindowOperationBehaviour(behaviour) => { self.unmanaged_window_operation_behaviour = behaviour; } - SocketMessage::ActiveWindowBorder(enable) => { + SocketMessage::Border(enable) => { border_manager::BORDER_ENABLED.store(enable, Ordering::SeqCst); } - SocketMessage::ActiveWindowBorderColour(kind, r, g, b) => match kind { + SocketMessage::BorderColour(kind, r, g, b) => match kind { WindowKind::Single => { border_manager::FOCUSED.store(Rgb::new(r, g, b).into(), Ordering::SeqCst); } @@ -1222,9 +1222,9 @@ impl WindowManager { border_manager::UNFOCUSED.store(Rgb::new(r, g, b).into(), Ordering::SeqCst); } }, - SocketMessage::ActiveWindowBorderStyle(style) => { - let mut active_window_border_style = STYLE.lock(); - *active_window_border_style = style; + SocketMessage::BorderStyle(style) => { + let mut border_style = STYLE.lock(); + *border_style = style; } SocketMessage::BorderWidth(width) => { border_manager::BORDER_WIDTH.store(width, Ordering::SeqCst); diff --git a/komorebi/src/static_config.rs b/komorebi/src/static_config.rs index af4ebb86..3ce2e8ec 100644 --- a/komorebi/src/static_config.rs +++ b/komorebi/src/static_config.rs @@ -42,8 +42,8 @@ use komorebi_core::config_generation::IdWithIdentifier; use komorebi_core::config_generation::MatchingRule; use komorebi_core::config_generation::MatchingStrategy; use komorebi_core::resolve_home_path; -use komorebi_core::ActiveWindowBorderStyle; use komorebi_core::ApplicationIdentifier; +use komorebi_core::BorderStyle; use komorebi_core::DefaultLayout; use komorebi_core::FocusFollowsMouseImplementation; use komorebi_core::HidingBehaviour; @@ -69,7 +69,7 @@ use uds_windows::UnixListener; use uds_windows::UnixStream; #[derive(Debug, Serialize, Deserialize, JsonSchema)] -pub struct ActiveWindowBorderColours { +pub struct BorderColours { /// Border colour when the container contains a single window pub single: Option, /// Border colour when the container contains multiple windows @@ -262,16 +262,19 @@ pub struct StaticConfig { pub border_offset: Option, /// Display an active window border (default: false) #[serde(skip_serializing_if = "Option::is_none")] - pub active_window_border: Option, + #[serde(alias = "active_window_border")] + pub border: Option, /// Active window border colours for different container types #[serde(skip_serializing_if = "Option::is_none")] - pub active_window_border_colours: Option, + #[serde(alias = "active_window_border_colours")] + pub border_colours: Option, /// Active window border style (default: System) #[serde(skip_serializing_if = "Option::is_none")] - pub active_window_border_style: Option, + #[serde(alias = "active_window_border_style")] + pub border_style: Option, /// Active window border z-order (default: System) #[serde(skip_serializing_if = "Option::is_none")] - pub active_window_border_z_order: Option, + pub border_z_order: Option, /// Global default workspace padding (default: 10) #[serde(skip_serializing_if = "Option::is_none")] pub default_workspace_padding: Option, @@ -394,7 +397,7 @@ impl From<&WindowManager> for StaticConfig { let border_colours = if border_manager::FOCUSED.load(Ordering::SeqCst) == 0 { None } else { - Option::from(ActiveWindowBorderColours { + Option::from(BorderColours { single: Option::from(Colour::from(border_manager::FOCUSED.load(Ordering::SeqCst))), stack: Option::from(Colour::from(border_manager::STACK.load(Ordering::SeqCst))), monocle: Option::from(Colour::from(border_manager::MONOCLE.load(Ordering::SeqCst))), @@ -417,12 +420,10 @@ impl From<&WindowManager> for StaticConfig { app_specific_configuration_path: None, border_width: Option::from(border_manager::BORDER_WIDTH.load(Ordering::SeqCst)), border_offset: Option::from(border_manager::BORDER_OFFSET.load(Ordering::SeqCst)), - active_window_border: Option::from( - border_manager::BORDER_ENABLED.load(Ordering::SeqCst), - ), - active_window_border_colours: border_colours, - active_window_border_style: Option::from(*STYLE.lock()), - active_window_border_z_order: Option::from(*Z_ORDER.lock()), + border: Option::from(border_manager::BORDER_ENABLED.load(Ordering::SeqCst)), + border_colours, + border_style: Option::from(*STYLE.lock()), + border_z_order: Option::from(*Z_ORDER.lock()), default_workspace_padding: Option::from( DEFAULT_WORKSPACE_PADDING.load(Ordering::SeqCst), ), @@ -474,11 +475,11 @@ impl StaticConfig { border_manager::BORDER_WIDTH.store(self.border_width.unwrap_or(8), Ordering::SeqCst); border_manager::BORDER_OFFSET.store(self.border_offset.unwrap_or(-1), Ordering::SeqCst); - if let Some(enabled) = &self.active_window_border { + if let Some(enabled) = &self.border { border_manager::BORDER_ENABLED.store(*enabled, Ordering::SeqCst); } - if let Some(colours) = &self.active_window_border_colours { + if let Some(colours) = &self.border_colours { if let Some(single) = colours.single { border_manager::FOCUSED.store(u32::from(single), Ordering::SeqCst); } @@ -496,8 +497,8 @@ impl StaticConfig { } } - let active_window_border_style = self.active_window_border_style.unwrap_or_default(); - *STYLE.lock() = active_window_border_style; + let border_style = self.border_style.unwrap_or_default(); + *STYLE.lock() = border_style; let mut float_identifiers = FLOAT_IDENTIFIERS.lock(); let mut regex_identifiers = REGEX_IDENTIFIERS.lock(); @@ -733,7 +734,7 @@ impl StaticConfig { } } - if value.active_window_border == Some(true) { + if value.border == Some(true) { border_manager::BORDER_ENABLED.store(true, Ordering::SeqCst); } @@ -792,7 +793,7 @@ impl StaticConfig { } } - if let Some(enabled) = value.active_window_border { + if let Some(enabled) = value.border { border_manager::BORDER_ENABLED.store(enabled, Ordering::SeqCst); } diff --git a/komorebi/src/window_manager.rs b/komorebi/src/window_manager.rs index 32875d30..10baa6bc 100644 --- a/komorebi/src/window_manager.rs +++ b/komorebi/src/window_manager.rs @@ -24,9 +24,9 @@ use uds_windows::UnixListener; use komorebi_core::config_generation::MatchingRule; use komorebi_core::custom_layout::CustomLayout; -use komorebi_core::ActiveWindowBorderStyle; use komorebi_core::Arrangement; use komorebi_core::Axis; +use komorebi_core::BorderStyle; use komorebi_core::CycleDirection; use komorebi_core::DefaultLayout; use komorebi_core::FocusFollowsMouseImplementation; @@ -52,7 +52,7 @@ use crate::window_manager_event::WindowManagerEvent; use crate::windows_api::WindowsApi; use crate::winevent_listener; use crate::workspace::Workspace; -use crate::ActiveWindowBorderColours; +use crate::BorderColours; use crate::Colour; use crate::Rgb; use crate::WorkspaceRule; @@ -117,9 +117,9 @@ pub struct State { #[allow(clippy::struct_excessive_bools)] #[derive(Debug, Serialize, Deserialize, JsonSchema)] pub struct GlobalState { - pub active_window_border_enabled: bool, - pub active_window_border_colours: ActiveWindowBorderColours, - pub active_window_border_style: ActiveWindowBorderStyle, + pub border_enabled: bool, + pub border_colours: BorderColours, + pub border_style: BorderStyle, pub border_offset: i32, pub border_width: i32, pub stackbar_mode: StackbarMode, @@ -146,8 +146,8 @@ pub struct GlobalState { impl Default for GlobalState { fn default() -> Self { Self { - active_window_border_enabled: border_manager::BORDER_ENABLED.load(Ordering::SeqCst), - active_window_border_colours: ActiveWindowBorderColours { + border_enabled: border_manager::BORDER_ENABLED.load(Ordering::SeqCst), + border_colours: BorderColours { single: Option::from(Colour::Rgb(Rgb::from( border_manager::FOCUSED.load(Ordering::SeqCst), ))), @@ -161,7 +161,7 @@ impl Default for GlobalState { border_manager::UNFOCUSED.load(Ordering::SeqCst), ))), }, - active_window_border_style: *STYLE.lock(), + border_style: *STYLE.lock(), border_offset: border_manager::BORDER_OFFSET.load(Ordering::SeqCst), border_width: border_manager::BORDER_WIDTH.load(Ordering::SeqCst), stackbar_mode: *STACKBAR_MODE.lock(), diff --git a/komorebic/src/main.rs b/komorebic/src/main.rs index cdde2f17..7eafd97e 100644 --- a/komorebic/src/main.rs +++ b/komorebic/src/main.rs @@ -651,13 +651,13 @@ struct FocusFollowsMouse { } #[derive(Parser, AhkFunction)] -struct ActiveWindowBorder { +struct Border { #[clap(value_enum)] boolean_state: BooleanState, } #[derive(Parser, AhkFunction)] -struct ActiveWindowBorderColour { +struct BorderColour { #[clap(value_enum, short, long, default_value = "single")] window_kind: WindowKind, /// Red @@ -669,14 +669,14 @@ struct ActiveWindowBorderColour { } #[derive(Parser, AhkFunction)] -struct ActiveWindowBorderWidth { - /// Desired width of the active window border +struct BorderWidth { + /// Desired width of the window border width: i32, } #[derive(Parser, AhkFunction)] -struct ActiveWindowBorderOffset { - /// Desired offset of the active window border +struct BorderOffset { + /// Desired offset of the window border offset: i32, } @@ -1141,18 +1141,22 @@ enum SubCommand { #[clap(hide = true)] #[clap(alias = "identify-border-overflow")] IdentifyBorderOverflowApplication(IdentifyBorderOverflowApplication), - /// Enable or disable the active window border + /// Enable or disable borders #[clap(arg_required_else_help = true)] - ActiveWindowBorder(ActiveWindowBorder), - /// Set the colour for the active window border + #[clap(alias = "active-window-border")] + Border(Border), + /// Set the colour for a window border kind #[clap(arg_required_else_help = true)] - ActiveWindowBorderColour(ActiveWindowBorderColour), - /// Set the width for the active window border + #[clap(alias = "active-window-border-colour")] + BorderColour(BorderColour), + /// Set the border width #[clap(arg_required_else_help = true)] - ActiveWindowBorderWidth(ActiveWindowBorderWidth), - /// Set the offset for the active window border + #[clap(alias = "active-window-border-width")] + BorderWidth(BorderWidth), + /// Set the border offset #[clap(arg_required_else_help = true)] - ActiveWindowBorderOffset(ActiveWindowBorderOffset), + #[clap(alias = "active-window-border-offset")] + BorderOffset(BorderOffset), /// Enable or disable focus follows mouse for the operating system #[clap(arg_required_else_help = true)] FocusFollowsMouse(FocusFollowsMouse), @@ -1930,6 +1934,7 @@ if (!(Get-Process whkd -ErrorAction SilentlyContinue)) "* Subscribe to https://youtube.com/@LGUG2Z - Live dev videos and feature previews" ); println!("* Join the Discord https://discord.gg/mGkn66PHkx - Chat, ask questions, share your desktops"); + println!("* Read the docs https://lgug2z.github.io/komorebi - Quickly search through all komorebic commands"); } SubCommand::Stop(arg) => { if arg.whkd { @@ -2212,19 +2217,18 @@ Stop-Process -Name:komorebi -ErrorAction SilentlyContinue SubCommand::MouseFollowsFocus(arg) => { send_message(&SocketMessage::MouseFollowsFocus(arg.boolean_state.into()).as_bytes()?)?; } - SubCommand::ActiveWindowBorder(arg) => { - send_message(&SocketMessage::ActiveWindowBorder(arg.boolean_state.into()).as_bytes()?)?; + SubCommand::Border(arg) => { + send_message(&SocketMessage::Border(arg.boolean_state.into()).as_bytes()?)?; } - SubCommand::ActiveWindowBorderColour(arg) => { + SubCommand::BorderColour(arg) => { send_message( - &SocketMessage::ActiveWindowBorderColour(arg.window_kind, arg.r, arg.g, arg.b) - .as_bytes()?, + &SocketMessage::BorderColour(arg.window_kind, arg.r, arg.g, arg.b).as_bytes()?, )?; } - SubCommand::ActiveWindowBorderWidth(arg) => { + SubCommand::BorderWidth(arg) => { send_message(&SocketMessage::BorderWidth(arg.width).as_bytes()?)?; } - SubCommand::ActiveWindowBorderOffset(arg) => { + SubCommand::BorderOffset(arg) => { send_message(&SocketMessage::BorderOffset(arg.offset).as_bytes()?)?; } SubCommand::ResizeDelta(arg) => { diff --git a/mkdocs.yml b/mkdocs.yml index 2ae9ec4c..c5c7ca6b 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -57,7 +57,7 @@ nav: - Troubleshooting: troubleshooting.md - Common workflows: - common-workflows/komorebi-config-home.md - - common-workflows/active-window-border.md + - common-workflows/borders.md - common-workflows/stackbar.md - common-workflows/remove-gaps.md - common-workflows/ignore-windows.md @@ -67,7 +67,7 @@ nav: - common-workflows/mouse-follows-focus.md - common-workflows/custom-layouts.md - common-workflows/dynamic-layout-switching.md - # - common-workflows/autohotkey.md + - common-workflows/autohotkey.md - Release notes: - release/v0-1-22.md - Configuration reference: https://komorebi.lgug2z.com/schema @@ -189,10 +189,10 @@ nav: - cli/identify-layered-application.md - cli/remove-title-bar.md - cli/toggle-title-bars.md - - cli/active-window-border.md - - cli/active-window-border-colour.md - - cli/active-window-border-width.md - - cli/active-window-border-offset.md + - cli/border.md + - cli/border-colour.md + - cli/border-width.md + - cli/border-offset.md - cli/focus-follows-mouse.md - cli/toggle-focus-follows-mouse.md - cli/mouse-follows-focus.md diff --git a/schema.json b/schema.json index b18a1223..4ef89c67 100644 --- a/schema.json +++ b/schema.json @@ -4,18 +4,17 @@ "description": "The `komorebi.json` static configuration file reference for `v0.1.25`", "type": "object", "properties": { - "active_window_border": { + "app_specific_configuration_path": { + "description": "Path to applications.yaml from komorebi-application-specific-configurations (default: None)", + "type": "string" + }, + "border": { "description": "Display an active window border (default: false)", "type": "boolean" }, - "active_window_border_colours": { + "border_colours": { "description": "Active window border colours for different container types", "type": "object", - "required": [ - "monocle", - "single", - "stack" - ], "properties": { "monocle": { "description": "Border colour when the container is in monocle mode", @@ -130,38 +129,46 @@ "type": "string" } ] - } - } - }, - "active_window_border_style": { - "description": "Active window border style (default: System)", - "oneOf": [ - { - "description": "Use the system border style", - "type": "string", - "enum": [ - "System" - ] }, - { - "description": "Use the Windows 11-style rounded borders", - "type": "string", - "enum": [ - "Rounded" - ] - }, - { - "description": "Use the Windows 10-style square borders", - "type": "string", - "enum": [ - "Square" + "unfocused": { + "description": "Border colour when the container is unfocused", + "anyOf": [ + { + "description": "Colour represented as RGB", + "type": "object", + "required": [ + "b", + "g", + "r" + ], + "properties": { + "b": { + "description": "Blue", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "g": { + "description": "Green", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "r": { + "description": "Red", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + }, + { + "description": "Colour represented as Hex", + "type": "string" + } ] } - ] - }, - "app_specific_configuration_path": { - "description": "Path to applications.yaml from komorebi-application-specific-configurations (default: None)", - "type": "string" + } }, "border_offset": { "description": "Offset of the window border (default: -1)", @@ -251,11 +258,47 @@ ] } }, + "border_style": { + "description": "Active window border style (default: System)", + "oneOf": [ + { + "description": "Use the system border style", + "type": "string", + "enum": [ + "System" + ] + }, + { + "description": "Use the Windows 11-style rounded borders", + "type": "string", + "enum": [ + "Rounded" + ] + }, + { + "description": "Use the Windows 10-style square borders", + "type": "string", + "enum": [ + "Square" + ] + } + ] + }, "border_width": { "description": "Width of the window border (default: 8)", "type": "integer", "format": "int32" }, + "border_z_order": { + "description": "Active window border z-order (default: System)", + "type": "string", + "enum": [ + "Top", + "NoTopMost", + "Bottom", + "TopMost" + ] + }, "cross_monitor_move_behaviour": { "description": "Determine what happens when a window is moved across a monitor boundary (default: Swap)", "oneOf": [ @@ -272,6 +315,13 @@ "enum": [ "Insert" ] + }, + { + "description": "Do nothing if trying to move a window container in the direction of an adjacent monitor", + "type": "string", + "enum": [ + "NoOp" + ] } ] }, @@ -668,6 +718,43 @@ "workspaces" ], "properties": { + "window_based_work_area_offset": { + "description": "Window based work area offset (default: None)", + "type": "object", + "required": [ + "bottom", + "left", + "right", + "top" + ], + "properties": { + "bottom": { + "description": "The bottom point in a Win32 Rect", + "type": "integer", + "format": "int32" + }, + "left": { + "description": "The left point in a Win32 Rect", + "type": "integer", + "format": "int32" + }, + "right": { + "description": "The right point in a Win32 Rect", + "type": "integer", + "format": "int32" + }, + "top": { + "description": "The top point in a Win32 Rect", + "type": "integer", + "format": "int32" + } + } + }, + "window_based_work_area_offset_limit": { + "description": "Open window limit after which the window based work area offset will no longer be applied (default: 1)", + "type": "integer", + "format": "int" + }, "work_area_offset": { "description": "Monitor-specific work area offset (default: None)", "type": "object",