diff --git a/komorebi-client/src/lib.rs b/komorebi-client/src/lib.rs index 589142c0..969fd340 100644 --- a/komorebi-client/src/lib.rs +++ b/komorebi-client/src/lib.rs @@ -1,15 +1,22 @@ #![warn(clippy::all, clippy::nursery, clippy::pedantic)] #![allow(clippy::missing_errors_doc)] +pub use komorebi::colour::Colour; +pub use komorebi::colour::Rgb; pub use komorebi::container::Container; pub use komorebi::monitor::Monitor; 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::GlobalState; pub use komorebi::Notification; pub use komorebi::NotificationEvent; +pub use komorebi::StackbarConfig; pub use komorebi::State; +pub use komorebi::TabsConfig; +pub use komorebi_core::ActiveWindowBorderStyle; pub use komorebi_core::Arrangement; pub use komorebi_core::Axis; pub use komorebi_core::CustomLayout; @@ -20,6 +27,8 @@ pub use komorebi_core::Layout; pub use komorebi_core::OperationDirection; pub use komorebi_core::Rect; pub use komorebi_core::SocketMessage; +pub use komorebi_core::StackbarMode; +pub use komorebi_core::WindowKind; use komorebi::DATA_DIR; diff --git a/komorebi-core/src/arrangement.rs b/komorebi-core/src/arrangement.rs index b8f19749..3403df13 100644 --- a/komorebi-core/src/arrangement.rs +++ b/komorebi-core/src/arrangement.rs @@ -321,7 +321,6 @@ impl Arrangement for CustomLayout { #[derive( Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema, )] -#[strum(serialize_all = "snake_case")] pub enum Axis { Horizontal, Vertical, diff --git a/komorebi-core/src/cycle_direction.rs b/komorebi-core/src/cycle_direction.rs index b06cc70d..8fc0b685 100644 --- a/komorebi-core/src/cycle_direction.rs +++ b/komorebi-core/src/cycle_direction.rs @@ -10,7 +10,6 @@ use strum::EnumString; #[derive( Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema, )] -#[strum(serialize_all = "snake_case")] pub enum CycleDirection { Previous, Next, diff --git a/komorebi-core/src/default_layout.rs b/komorebi-core/src/default_layout.rs index bf7cb9db..c804cf6e 100644 --- a/komorebi-core/src/default_layout.rs +++ b/komorebi-core/src/default_layout.rs @@ -10,9 +10,18 @@ use crate::Rect; use crate::Sizing; #[derive( - Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema, + Clone, + Copy, + Debug, + Serialize, + Deserialize, + Eq, + PartialEq, + Display, + EnumString, + ValueEnum, + JsonSchema, )] -#[strum(serialize_all = "snake_case")] pub enum DefaultLayout { BSP, Columns, diff --git a/komorebi-core/src/lib.rs b/komorebi-core/src/lib.rs index 3e6112b4..8891946a 100644 --- a/komorebi-core/src/lib.rs +++ b/komorebi-core/src/lib.rs @@ -131,9 +131,16 @@ pub enum SocketMessage { AltFocusHack(bool), ActiveWindowBorder(bool), ActiveWindowBorderColour(WindowKind, u32, u32, u32), - ActiveWindowBorderWidth(i32), - ActiveWindowBorderOffset(i32), + ActiveWindowBorderStyle(ActiveWindowBorderStyle), + BorderWidth(i32), + BorderOffset(i32), InvisibleBorders(Rect), + StackbarMode(StackbarMode), + StackbarFocusedTextColour(u32, u32, u32), + StackbarUnfocusedTextColour(u32, u32, u32), + StackbarBackgroundColour(u32, u32, u32), + StackbarHeight(i32), + StackbarTabWidth(i32), WorkAreaOffset(Rect), MonitorWorkAreaOffset(usize, Rect), ResizeDelta(i32), @@ -148,6 +155,7 @@ pub enum SocketMessage { IdentifyLayeredApplication(ApplicationIdentifier, String), IdentifyBorderOverflowApplication(ApplicationIdentifier, String), State, + GlobalState, VisibleWindows, Query(StateQuery), FocusFollowsMouse(FocusFollowsMouseImplementation, bool), @@ -181,10 +189,29 @@ impl FromStr for SocketMessage { } } +#[derive(Debug, Copy, Clone, Eq, PartialEq, Display, Serialize, Deserialize, JsonSchema)] +pub enum StackbarMode { + Always, + Never, + OnStack, +} + +#[derive( + Default, Copy, Clone, Debug, Eq, PartialEq, Display, Serialize, Deserialize, JsonSchema, +)] +pub enum ActiveWindowBorderStyle { + #[default] + /// Use the system border style + System, + /// Use the Windows 11-style rounded borders + Rounded, + /// Use the Windows 10-style square borders + Square, +} + #[derive( Copy, Clone, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema, )] -#[strum(serialize_all = "snake_case")] pub enum WindowKind { Single, Stack, @@ -194,7 +221,6 @@ pub enum WindowKind { #[derive( Copy, Clone, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema, )] -#[strum(serialize_all = "snake_case")] pub enum StateQuery { FocusedMonitorIndex, FocusedWorkspaceIndex, @@ -215,7 +241,6 @@ pub enum StateQuery { ValueEnum, JsonSchema, )] -#[strum(serialize_all = "snake_case")] pub enum ApplicationIdentifier { #[serde(alias = "exe")] Exe, @@ -230,7 +255,6 @@ pub enum ApplicationIdentifier { #[derive( Copy, Clone, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema, )] -#[strum(serialize_all = "snake_case")] pub enum FocusFollowsMouseImplementation { /// A custom FFM implementation (slightly more CPU-intensive) Komorebi, @@ -241,7 +265,6 @@ pub enum FocusFollowsMouseImplementation { #[derive( Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema, )] -#[strum(serialize_all = "snake_case")] pub enum WindowContainerBehaviour { /// Create a new container for each new window Create, @@ -252,7 +275,6 @@ pub enum WindowContainerBehaviour { #[derive( Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema, )] -#[strum(serialize_all = "snake_case")] pub enum MoveBehaviour { /// Swap the window container with the window container at the edge of the adjacent monitor Swap, @@ -263,7 +285,6 @@ pub enum MoveBehaviour { #[derive( Copy, Clone, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema, )] -#[strum(serialize_all = "snake_case")] pub enum HidingBehaviour { /// Use the SW_HIDE flag to hide windows when switching workspaces (has issues with Electron apps) Hide, @@ -276,7 +297,6 @@ pub enum HidingBehaviour { #[derive( Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema, )] -#[strum(serialize_all = "snake_case")] pub enum OperationBehaviour { /// Process komorebic commands on temporarily unmanaged/floated windows Op, @@ -287,7 +307,6 @@ pub enum OperationBehaviour { #[derive( Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema, )] -#[strum(serialize_all = "snake_case")] pub enum Sizing { Increase, Decrease, diff --git a/komorebi-core/src/operation_direction.rs b/komorebi-core/src/operation_direction.rs index 25f8d93c..7ef0ae04 100644 --- a/komorebi-core/src/operation_direction.rs +++ b/komorebi-core/src/operation_direction.rs @@ -13,7 +13,6 @@ use crate::Axis; #[derive( Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema, )] -#[strum(serialize_all = "snake_case")] pub enum OperationDirection { Left, Right, diff --git a/komorebi/src/container.rs b/komorebi/src/container.rs index 19fce336..bbcac493 100644 --- a/komorebi/src/container.rs +++ b/komorebi/src/container.rs @@ -9,8 +9,8 @@ use serde::Serialize; use crate::ring::Ring; use crate::stackbar::Stackbar; use crate::window::Window; -use crate::StackbarMode; use crate::STACKBAR_MODE; +use komorebi_core::StackbarMode; #[derive(Debug, Clone, Serialize, Deserialize, Getters, JsonSchema)] pub struct Container { diff --git a/komorebi/src/lib.rs b/komorebi/src/lib.rs index 9cea698a..016162ae 100644 --- a/komorebi/src/lib.rs +++ b/komorebi/src/lib.rs @@ -37,6 +37,7 @@ use std::sync::atomic::AtomicU32; use std::sync::atomic::Ordering; use std::sync::Arc; +pub use colour::*; pub use hidden::*; pub use process_command::*; pub use process_event::*; @@ -51,10 +52,12 @@ use color_eyre::Result; use komorebi_core::config_generation::IdWithIdentifier; use komorebi_core::config_generation::MatchingRule; use komorebi_core::config_generation::MatchingStrategy; +use komorebi_core::ActiveWindowBorderStyle; use komorebi_core::ApplicationIdentifier; use komorebi_core::HidingBehaviour; use komorebi_core::Rect; use komorebi_core::SocketMessage; +use komorebi_core::StackbarMode; use os_info::Version; use parking_lot::Mutex; use regex::Regex; diff --git a/komorebi/src/process_command.rs b/komorebi/src/process_command.rs index ca1d3f6d..60a012eb 100644 --- a/komorebi/src/process_command.rs +++ b/komorebi/src/process_command.rs @@ -48,8 +48,10 @@ use crate::window::Window; use crate::window_manager; use crate::window_manager::WindowManager; use crate::windows_api::WindowsApi; +use crate::GlobalState; use crate::Notification; use crate::NotificationEvent; +use crate::ACTIVE_WINDOW_BORDER_STYLE; use crate::BORDER_COLOUR_CURRENT; use crate::BORDER_COLOUR_MONOCLE; use crate::BORDER_COLOUR_SINGLE; @@ -71,6 +73,12 @@ use crate::MONITOR_INDEX_PREFERENCES; use crate::NO_TITLEBAR; use crate::OBJECT_NAME_CHANGE_ON_LAUNCH; use crate::REMOVE_TITLEBARS; +use crate::STACKBAR_FOCUSED_TEXT_COLOUR; +use crate::STACKBAR_MODE; +use crate::STACKBAR_TAB_BACKGROUND_COLOUR; +use crate::STACKBAR_TAB_HEIGHT; +use crate::STACKBAR_TAB_WIDTH; +use crate::STACKBAR_UNFOCUSED_TEXT_COLOUR; use crate::SUBSCRIPTION_PIPES; use crate::SUBSCRIPTION_SOCKETS; use crate::TCP_CONNECTIONS; @@ -766,6 +774,18 @@ impl WindowManager { tracing::info!("replying to state done"); } + SocketMessage::GlobalState => { + let state = match serde_json::to_string_pretty(&GlobalState::default()) { + Ok(state) => state, + Err(error) => error.to_string(), + }; + + tracing::info!("replying to global state"); + + reply.write_all(state.as_bytes())?; + + tracing::info!("replying to global state done"); + } SocketMessage::VisibleWindows => { let mut monitor_visible_windows = HashMap::new(); @@ -1242,14 +1262,42 @@ impl WindowManager { WindowsApi::invalidate_border_rect()?; } - SocketMessage::ActiveWindowBorderWidth(width) => { + SocketMessage::ActiveWindowBorderStyle(style) => { + let mut active_window_border_style = ACTIVE_WINDOW_BORDER_STYLE.lock(); + *active_window_border_style = style; + + WindowsApi::invalidate_border_rect()?; + } + SocketMessage::BorderWidth(width) => { BORDER_WIDTH.store(width, Ordering::SeqCst); WindowsApi::invalidate_border_rect()?; } - SocketMessage::ActiveWindowBorderOffset(offset) => { + SocketMessage::BorderOffset(offset) => { BORDER_OFFSET.store(offset, Ordering::SeqCst); WindowsApi::invalidate_border_rect()?; } + SocketMessage::StackbarMode(mode) => { + let mut stackbar_mode = STACKBAR_MODE.lock(); + *stackbar_mode = mode; + } + SocketMessage::StackbarFocusedTextColour(r, g, b) => { + let rgb = Rgb::new(r, g, b); + STACKBAR_FOCUSED_TEXT_COLOUR.store(rgb.into(), Ordering::SeqCst); + } + SocketMessage::StackbarUnfocusedTextColour(r, g, b) => { + let rgb = Rgb::new(r, g, b); + STACKBAR_UNFOCUSED_TEXT_COLOUR.store(rgb.into(), Ordering::SeqCst); + } + SocketMessage::StackbarBackgroundColour(r, g, b) => { + let rgb = Rgb::new(r, g, b); + STACKBAR_TAB_BACKGROUND_COLOUR.store(rgb.into(), Ordering::SeqCst); + } + SocketMessage::StackbarHeight(height) => { + STACKBAR_TAB_HEIGHT.store(height, Ordering::SeqCst); + } + SocketMessage::StackbarTabWidth(width) => { + STACKBAR_TAB_WIDTH.store(width, Ordering::SeqCst); + } SocketMessage::ApplicationSpecificConfigurationSchema => { let asc = schema_for!(Vec); let schema = serde_json::to_string_pretty(&asc)?; @@ -1358,7 +1406,7 @@ impl WindowManager { | SocketMessage::Retile // Adding this one so that changes can be seen instantly after // modifying the active window border offset - | SocketMessage::ActiveWindowBorderOffset(_) + | SocketMessage::BorderOffset(_) // Adding this one because sometimes EVENT_SYSTEM_FOREGROUND isn't // getting sent on FocusWindow, meaning the border won't be set // when processing events @@ -1512,9 +1560,10 @@ pub fn read_commands_uds(wm: &Arc>, mut stream: UnixStream) if wm.is_paused { return match message { - SocketMessage::TogglePause | SocketMessage::State | SocketMessage::Stop => { - Ok(wm.process_command(message, &mut stream)?) - } + SocketMessage::TogglePause + | SocketMessage::State + | SocketMessage::GlobalState + | SocketMessage::Stop => Ok(wm.process_command(message, &mut stream)?), _ => { tracing::trace!("ignoring while paused"); Ok(()) @@ -1561,9 +1610,10 @@ pub fn read_commands_tcp( if wm.is_paused { return match message { - SocketMessage::TogglePause | SocketMessage::State | SocketMessage::Stop => { - Ok(wm.process_command(message, stream)?) - } + SocketMessage::TogglePause + | SocketMessage::State + | SocketMessage::GlobalState + | SocketMessage::Stop => Ok(wm.process_command(message, stream)?), _ => { tracing::trace!("ignoring while paused"); Ok(()) diff --git a/komorebi/src/static_config.rs b/komorebi/src/static_config.rs index 9e64ab58..57442ac6 100644 --- a/komorebi/src/static_config.rs +++ b/komorebi/src/static_config.rs @@ -35,6 +35,7 @@ use crate::STACKBAR_TAB_WIDTH; use crate::STACKBAR_UNFOCUSED_TEXT_COLOUR; use crate::TRAY_AND_MULTI_WINDOW_IDENTIFIERS; use crate::WORKSPACE_RULES; +use komorebi_core::StackbarMode; use color_eyre::Result; use crossbeam_channel::Receiver; @@ -47,6 +48,7 @@ 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::DefaultLayout; use komorebi_core::FocusFollowsMouseImplementation; @@ -82,17 +84,6 @@ pub struct ActiveWindowBorderColours { pub monocle: Colour, } -#[derive(Default, Copy, Clone, Debug, Serialize, Deserialize, JsonSchema)] -pub enum ActiveWindowBorderStyle { - #[default] - /// Use the system border style - System, - /// Use the Windows 11-style rounded borders - Rounded, - /// Use the Windows 10-style square borders - Square, -} - #[derive(Debug, Serialize, Deserialize, JsonSchema)] pub struct WorkspaceConfig { /// Name @@ -317,13 +308,6 @@ pub struct StaticConfig { pub stackbar: Option, } -#[derive(Debug, Copy, Clone, Serialize, Deserialize, JsonSchema)] -pub enum StackbarMode { - Always, - Never, - OnStack, -} - #[derive(Debug, Serialize, Deserialize, JsonSchema)] pub struct TabsConfig { width: Option, @@ -334,9 +318,9 @@ pub struct TabsConfig { #[derive(Debug, Serialize, Deserialize, JsonSchema)] pub struct StackbarConfig { - height: Option, - mode: Option, - tabs: Option, + pub height: Option, + pub mode: Option, + pub tabs: Option, } impl From<&WindowManager> for StaticConfig { diff --git a/komorebi/src/window_manager.rs b/komorebi/src/window_manager.rs index 01e092ea..7ff82a18 100644 --- a/komorebi/src/window_manager.rs +++ b/komorebi/src/window_manager.rs @@ -23,11 +23,13 @@ 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::CycleDirection; use komorebi_core::DefaultLayout; use komorebi_core::FocusFollowsMouseImplementation; +use komorebi_core::HidingBehaviour; use komorebi_core::Layout; use komorebi_core::MoveBehaviour; use komorebi_core::OperationBehaviour; @@ -48,10 +50,23 @@ use crate::window_manager_event::WindowManagerEvent; use crate::windows_api::WindowsApi; use crate::winevent_listener; use crate::workspace::Workspace; +use crate::ActiveWindowBorderColours; +use crate::Colour; +use crate::Rgb; +use crate::WorkspaceRule; +use crate::ACTIVE_WINDOW_BORDER_STYLE; +use crate::BORDER_COLOUR_MONOCLE; +use crate::BORDER_COLOUR_SINGLE; +use crate::BORDER_COLOUR_STACK; +use crate::BORDER_ENABLED; use crate::BORDER_HWND; +use crate::BORDER_OFFSET; +use crate::BORDER_WIDTH; +use crate::CUSTOM_FFM; use crate::DATA_DIR; use crate::DISPLAY_INDEX_PREFERENCES; use crate::FLOAT_IDENTIFIERS; +use crate::HIDING_BEHAVIOUR; use crate::HOME_DIR; use crate::LAYERED_WHITELIST; use crate::MANAGE_IDENTIFIERS; @@ -59,8 +74,15 @@ use crate::MONITOR_INDEX_PREFERENCES; use crate::NO_TITLEBAR; use crate::OBJECT_NAME_CHANGE_ON_LAUNCH; use crate::REMOVE_TITLEBARS; +use crate::STACKBAR_FOCUSED_TEXT_COLOUR; +use crate::STACKBAR_MODE; +use crate::STACKBAR_TAB_BACKGROUND_COLOUR; +use crate::STACKBAR_TAB_HEIGHT; +use crate::STACKBAR_TAB_WIDTH; +use crate::STACKBAR_UNFOCUSED_TEXT_COLOUR; use crate::TRAY_AND_MULTI_WINDOW_IDENTIFIERS; use crate::WORKSPACE_RULES; +use komorebi_core::StackbarMode; #[derive(Debug)] pub struct WindowManager { @@ -91,10 +113,27 @@ pub struct State { pub resize_delta: i32, pub new_window_behaviour: WindowContainerBehaviour, pub cross_monitor_move_behaviour: MoveBehaviour, + pub unmanaged_window_operation_behaviour: OperationBehaviour, pub work_area_offset: Option, pub focus_follows_mouse: Option, pub mouse_follows_focus: bool, pub has_pending_raise_op: bool, +} + +#[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_offset: i32, + pub border_width: i32, + pub stackbar_mode: StackbarMode, + pub stackbar_focused_text_colour: Colour, + pub stackbar_unfocused_text_colour: Colour, + pub stackbar_tab_background_colour: Colour, + pub stackbar_tab_width: i32, + pub stackbar_height: i32, pub remove_titlebars: bool, pub float_identifiers: Vec, pub manage_identifiers: Vec, @@ -103,6 +142,52 @@ pub struct State { pub name_change_on_launch_identifiers: Vec, pub monitor_index_preferences: HashMap, pub display_index_preferences: HashMap, + pub workspace_rules: HashMap, + pub window_hiding_behaviour: HidingBehaviour, + pub configuration_dir: PathBuf, + pub data_dir: PathBuf, + pub custom_ffm: bool, +} + +impl Default for GlobalState { + fn default() -> Self { + Self { + active_window_border_enabled: BORDER_ENABLED.load(Ordering::SeqCst), + active_window_border_colours: ActiveWindowBorderColours { + single: Colour::Rgb(Rgb::from(BORDER_COLOUR_SINGLE.load(Ordering::SeqCst))), + stack: Colour::Rgb(Rgb::from(BORDER_COLOUR_STACK.load(Ordering::SeqCst))), + monocle: Colour::Rgb(Rgb::from(BORDER_COLOUR_MONOCLE.load(Ordering::SeqCst))), + }, + active_window_border_style: *ACTIVE_WINDOW_BORDER_STYLE.lock(), + border_offset: BORDER_OFFSET.load(Ordering::SeqCst), + border_width: BORDER_WIDTH.load(Ordering::SeqCst), + stackbar_mode: *STACKBAR_MODE.lock(), + stackbar_focused_text_colour: Colour::Rgb(Rgb::from( + STACKBAR_FOCUSED_TEXT_COLOUR.load(Ordering::SeqCst), + )), + stackbar_unfocused_text_colour: Colour::Rgb(Rgb::from( + STACKBAR_UNFOCUSED_TEXT_COLOUR.load(Ordering::SeqCst), + )), + stackbar_tab_background_colour: Colour::Rgb(Rgb::from( + STACKBAR_TAB_BACKGROUND_COLOUR.load(Ordering::SeqCst), + )), + stackbar_tab_width: STACKBAR_TAB_WIDTH.load(Ordering::SeqCst), + stackbar_height: STACKBAR_TAB_HEIGHT.load(Ordering::SeqCst), + remove_titlebars: REMOVE_TITLEBARS.load(Ordering::SeqCst), + float_identifiers: FLOAT_IDENTIFIERS.lock().clone(), + manage_identifiers: MANAGE_IDENTIFIERS.lock().clone(), + layered_whitelist: LAYERED_WHITELIST.lock().clone(), + tray_and_multi_window_identifiers: TRAY_AND_MULTI_WINDOW_IDENTIFIERS.lock().clone(), + name_change_on_launch_identifiers: OBJECT_NAME_CHANGE_ON_LAUNCH.lock().clone(), + monitor_index_preferences: MONITOR_INDEX_PREFERENCES.lock().clone(), + display_index_preferences: DISPLAY_INDEX_PREFERENCES.lock().clone(), + workspace_rules: WORKSPACE_RULES.lock().clone(), + window_hiding_behaviour: *HIDING_BEHAVIOUR.lock(), + configuration_dir: HOME_DIR.clone(), + data_dir: DATA_DIR.clone(), + custom_ffm: CUSTOM_FFM.load(Ordering::SeqCst), + } + } } impl AsRef for WindowManager { @@ -123,14 +208,7 @@ impl From<&WindowManager> for State { focus_follows_mouse: wm.focus_follows_mouse, mouse_follows_focus: wm.mouse_follows_focus, has_pending_raise_op: wm.has_pending_raise_op, - remove_titlebars: REMOVE_TITLEBARS.load(Ordering::SeqCst), - float_identifiers: FLOAT_IDENTIFIERS.lock().clone(), - manage_identifiers: MANAGE_IDENTIFIERS.lock().clone(), - layered_whitelist: LAYERED_WHITELIST.lock().clone(), - tray_and_multi_window_identifiers: TRAY_AND_MULTI_WINDOW_IDENTIFIERS.lock().clone(), - name_change_on_launch_identifiers: OBJECT_NAME_CHANGE_ON_LAUNCH.lock().clone(), - monitor_index_preferences: MONITOR_INDEX_PREFERENCES.lock().clone(), - display_index_preferences: DISPLAY_INDEX_PREFERENCES.lock().clone(), + unmanaged_window_operation_behaviour: wm.unmanaged_window_operation_behaviour, } } } diff --git a/komorebi/src/windows_callbacks.rs b/komorebi/src/windows_callbacks.rs index c6656058..94055081 100644 --- a/komorebi/src/windows_callbacks.rs +++ b/komorebi/src/windows_callbacks.rs @@ -41,7 +41,6 @@ use crate::window_manager_event::WindowManagerEvent; use crate::windows_api::WindowsApi; use crate::winevent::WinEvent; use crate::winevent_listener; -use crate::ActiveWindowBorderStyle; use crate::ACTIVE_WINDOW_BORDER_STYLE; use crate::BORDER_COLOUR_CURRENT; use crate::BORDER_RECT; @@ -50,6 +49,7 @@ use crate::DISPLAY_INDEX_PREFERENCES; use crate::MONITOR_INDEX_PREFERENCES; use crate::TRANSPARENCY_COLOUR; use crate::WINDOWS_11; +use komorebi_core::ActiveWindowBorderStyle; pub extern "system" fn valid_display_monitors( hmonitor: HMONITOR, diff --git a/komorebic/src/main.rs b/komorebic/src/main.rs index 0afac118..7946d19f 100644 --- a/komorebic/src/main.rs +++ b/komorebic/src/main.rs @@ -815,6 +815,8 @@ enum SubCommand { Whkdrc, /// Show a JSON representation of the current window manager state State, + /// Show a JSON representation of the current global state + GlobalState, /// Show a JSON representation of visible windows VisibleWindows, /// Query the current window manager state @@ -2025,6 +2027,9 @@ Stop-Process -Name:whkd -ErrorAction SilentlyContinue SubCommand::State => { print_query(&SocketMessage::State.as_bytes()?); } + SubCommand::GlobalState => { + print_query(&SocketMessage::GlobalState.as_bytes()?); + } SubCommand::VisibleWindows => { print_query(&SocketMessage::VisibleWindows.as_bytes()?); } @@ -2139,10 +2144,10 @@ Stop-Process -Name:whkd -ErrorAction SilentlyContinue )?; } SubCommand::ActiveWindowBorderWidth(arg) => { - send_message(&SocketMessage::ActiveWindowBorderWidth(arg.width).as_bytes()?)?; + send_message(&SocketMessage::BorderWidth(arg.width).as_bytes()?)?; } SubCommand::ActiveWindowBorderOffset(arg) => { - send_message(&SocketMessage::ActiveWindowBorderOffset(arg.offset).as_bytes()?)?; + send_message(&SocketMessage::BorderOffset(arg.offset).as_bytes()?)?; } SubCommand::ResizeDelta(arg) => { send_message(&SocketMessage::ResizeDelta(arg.pixels).as_bytes()?)?;