docs(config): encode defaults of unwrapped options into schema

This commit ensures that the various default values that the different
Option<T> config properties can be unwrapped to are encoded by schemars
so that they can be picked up by docgen.
This commit is contained in:
LGUG2Z
2025-12-26 18:16:55 -08:00
parent 66c5766848
commit a42e809ade
13 changed files with 709 additions and 396 deletions

View File

@@ -75,9 +75,11 @@ trace target $RUST_LOG="trace":
deadlock $RUST_LOG="trace":
cargo +stable run --bin komorebi --locked --no-default-features --features deadlock_detection
docgen:
cargo run --package komorebic -- docgen
Get-ChildItem -Path "docs/cli" -Recurse -File | ForEach-Object { (Get-Content $_.FullName) -replace 'Usage: ', 'Usage: komorebic.exe ' | Set-Content $_.FullName }
docgen starlight:
rm {{ starlight }}/src/data/cli/windows/*.md
cargo run --package komorebic -- docgen --output {{ starlight }}/src/data/cli/windows
schemars-docgen ./schema.json --output {{ starlight }}/src/content/docs/reference/komorebi-windows.mdx --format mdx --title "komorebi.json (Windows)" --description "komorebi for Windows configuration schema reference"
schemars-docgen ./schema.bar.json --output {{ starlight }}/src/content/docs/reference/bar-windows.mdx --format mdx --title "komorebi.bar.json (Windows)" --description "komorebi-bar for Windows configuration schema reference"
jsonschema:
cargo run --package komorebic -- static-config-schema > schema.json

View File

@@ -14,11 +14,24 @@ use serde::Serialize;
use std::collections::HashMap;
use std::path::PathBuf;
mod defaults {
pub const HEIGHT: f32 = 50.0;
pub const FONT_SIZE: f32 = 12.5;
pub const ICON_SCALE: f32 = 1.4;
pub const MAX_LABEL_WIDTH: f32 = 400.0;
pub const TRANSPARENCY_ALPHA: u8 = 200;
pub const WIDGET_SPACING: f32 = 10.0;
pub const SCROLL_THRESHOLD: f32 = 30.0;
pub const FOCUS_MONITOR_AT_CURSOR: bool = true;
pub const IGNORE_MOUSE_FOLLOWS_FOCUS: bool = true;
}
#[derive(Clone, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
/// The `komorebi.bar.json` configuration file reference for `v0.1.40`
pub struct KomobarConfig {
/// Bar height (default: 50)
/// Bar height
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::HEIGHT)))]
pub height: Option<f32>,
/// Bar padding. Use one value for all sides or use a grouped padding for horizontal and/or
/// vertical definition which can each take a single value for a symmetric padding or two
@@ -79,17 +92,22 @@ pub struct KomobarConfig {
pub monitor: MonitorConfigOrIndex,
/// Font family
pub font_family: Option<String>,
/// Font size (default: 12.5)
/// Font size
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::FONT_SIZE)))]
pub font_size: Option<f32>,
/// Scale of the icons relative to the font_size [[1.0-2.0]]. (default: 1.4)
/// Scale of the icons relative to the font_size [[1.0-2.0]]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::ICON_SCALE)))]
pub icon_scale: Option<f32>,
/// Max label width before text truncation (default: 400.0)
/// Max label width before text truncation
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::MAX_LABEL_WIDTH)))]
pub max_label_width: Option<f32>,
/// Theme
pub theme: Option<KomobarTheme>,
/// Alpha value for the color transparency [[0-255]] (default: 200)
/// Alpha value for the color transparency [[0-255]]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::TRANSPARENCY_ALPHA)))]
pub transparency_alpha: Option<u8>,
/// Spacing between widgets (default: 10.0)
/// Spacing between widgets
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::WIDGET_SPACING)))]
pub widget_spacing: Option<f32>,
/// Visual grouping for widgets
pub grouping: Option<Grouping>,
@@ -380,9 +398,11 @@ pub enum MouseMessage {
#[derive(Clone, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct KomorebiMouseMessage {
/// Send the FocusMonitorAtCursor message (default:true)
/// Send the FocusMonitorAtCursor message
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::FOCUS_MONITOR_AT_CURSOR)))]
pub focus_monitor_at_cursor: Option<bool>,
/// Wrap the {message} with a MouseFollowsFocus(false) and MouseFollowsFocus({original.value}) message (default:true)
/// Wrap the {message} with a MouseFollowsFocus(false) and MouseFollowsFocus({original.value}) message
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::IGNORE_MOUSE_FOLLOWS_FOCUS)))]
pub ignore_mouse_follows_focus: Option<bool>,
/// The message to send to the komorebi client
pub message: komorebi_client::SocketMessage,
@@ -402,14 +422,16 @@ pub struct MouseConfig {
/// Command to send on extra2/forward button click
pub on_extra2_click: Option<MouseMessage>,
/// Defines how many points a user needs to scroll vertically to make a "tick" on a mouse/touchpad/touchscreen (default: 30)
/// Defines how many points a user needs to scroll vertically to make a "tick" on a mouse/touchpad/touchscreen
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::SCROLL_THRESHOLD)))]
pub vertical_scroll_threshold: Option<f32>,
/// Command to send on scrolling up (every tick)
pub on_scroll_up: Option<MouseMessage>,
/// Command to send on scrolling down (every tick)
pub on_scroll_down: Option<MouseMessage>,
/// Defines how many points a user needs to scroll horizontally to make a "tick" on a mouse/touchpad/touchscreen (default: 30)
/// Defines how many points a user needs to scroll horizontally to make a "tick" on a mouse/touchpad/touchscreen
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::SCROLL_THRESHOLD)))]
pub horizontal_scroll_threshold: Option<f32>,
/// Command to send on scrolling left (every tick)
pub on_scroll_left: Option<MouseMessage>,

View File

@@ -17,6 +17,10 @@ use std::process::Command;
use std::time::Duration;
use std::time::Instant;
mod defaults {
pub const DATA_REFRESH_INTERVAL: u64 = 10;
}
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct BatteryConfig {
@@ -24,7 +28,8 @@ pub struct BatteryConfig {
pub enable: bool,
/// Hide the widget if the battery is at full charge
pub hide_on_full_charge: Option<bool>,
/// Data refresh interval (default: 10 seconds)
/// Data refresh interval in seconds
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::DATA_REFRESH_INTERVAL)))]
pub data_refresh_interval: Option<u64>,
/// Display label prefix
pub label_prefix: Option<LabelPrefix>,
@@ -34,7 +39,9 @@ pub struct BatteryConfig {
impl From<BatteryConfig> for Battery {
fn from(value: BatteryConfig) -> Self {
let data_refresh_interval = value.data_refresh_interval.unwrap_or(10);
let data_refresh_interval = value
.data_refresh_interval
.unwrap_or(defaults::DATA_REFRESH_INTERVAL);
Self {
enable: value.enable,

View File

@@ -16,12 +16,17 @@ use std::time::Instant;
use sysinfo::RefreshKind;
use sysinfo::System;
mod defaults {
pub const DATA_REFRESH_INTERVAL: u64 = 10;
}
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct CpuConfig {
/// Enable the Cpu widget
pub enable: bool,
/// Data refresh interval (default: 10 seconds)
/// Data refresh interval in seconds
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::DATA_REFRESH_INTERVAL)))]
pub data_refresh_interval: Option<u64>,
/// Display label prefix
pub label_prefix: Option<LabelPrefix>,
@@ -31,7 +36,9 @@ pub struct CpuConfig {
impl From<CpuConfig> for Cpu {
fn from(value: CpuConfig) -> Self {
let data_refresh_interval = value.data_refresh_interval.unwrap_or(10);
let data_refresh_interval = value
.data_refresh_interval
.unwrap_or(defaults::DATA_REFRESH_INTERVAL);
Self {
enable: value.enable,

View File

@@ -21,15 +21,18 @@ use windows::Win32::UI::Input::KeyboardAndMouse::GetKeyboardLayout;
use windows::Win32::UI::WindowsAndMessaging::GetForegroundWindow;
use windows::Win32::UI::WindowsAndMessaging::GetWindowThreadProcessId;
const DEFAULT_DATA_REFRESH_INTERVAL: u64 = 1;
const ERROR_TEXT: &str = "Error";
mod defaults {
pub const DATA_REFRESH_INTERVAL: u64 = 10;
pub const ERROR_TEXT: &str = "Error";
}
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct KeyboardConfig {
/// Enable the Input widget
pub enable: bool,
/// Data refresh interval (default: 1 second)
/// Data refresh interval
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::DATA_REFRESH_INTERVAL)))]
pub data_refresh_interval: Option<u64>,
/// Display label prefix
pub label_prefix: Option<LabelPrefix>,
@@ -39,7 +42,7 @@ impl From<KeyboardConfig> for Keyboard {
fn from(value: KeyboardConfig) -> Self {
let data_refresh_interval = value
.data_refresh_interval
.unwrap_or(DEFAULT_DATA_REFRESH_INTERVAL);
.unwrap_or(defaults::DATA_REFRESH_INTERVAL);
Self {
enable: value.enable,
@@ -124,7 +127,7 @@ fn get_active_keyboard_layout() -> eyre::Result<String, ()> {
fn get_lang() -> String {
get_active_keyboard_layout()
.map(|l| l.trim_end_matches('\0').to_string())
.unwrap_or_else(|_| ERROR_TEXT.to_string())
.unwrap_or_else(|_| defaults::ERROR_TEXT.to_string())
}
impl Keyboard {

View File

@@ -16,12 +16,17 @@ use std::time::Instant;
use sysinfo::RefreshKind;
use sysinfo::System;
mod defaults {
pub const DATA_REFRESH_INTERVAL: u64 = 10;
}
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct MemoryConfig {
/// Enable the Memory widget
pub enable: bool,
/// Data refresh interval (default: 10 seconds)
/// Data refresh interval in seconds
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::DATA_REFRESH_INTERVAL)))]
pub data_refresh_interval: Option<u64>,
/// Display label prefix
pub label_prefix: Option<LabelPrefix>,
@@ -31,7 +36,9 @@ pub struct MemoryConfig {
impl From<MemoryConfig> for Memory {
fn from(value: MemoryConfig) -> Self {
let data_refresh_interval = value.data_refresh_interval.unwrap_or(10);
let data_refresh_interval = value
.data_refresh_interval
.unwrap_or(defaults::DATA_REFRESH_INTERVAL);
Self {
enable: value.enable,

View File

@@ -24,6 +24,10 @@ use std::time::Duration;
use std::time::Instant;
use sysinfo::Networks;
mod defaults {
pub const DATA_REFRESH_INTERVAL: u64 = 10;
}
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct NetworkConfig {
@@ -40,7 +44,8 @@ pub struct NetworkConfig {
/// Characters to reserve for received and transmitted activity
#[serde(alias = "network_activity_fill_characters")]
pub activity_left_padding: Option<usize>,
/// Data refresh interval (default: 10 seconds)
/// Data refresh interval in seconds
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::DATA_REFRESH_INTERVAL)))]
pub data_refresh_interval: Option<u64>,
/// Display label prefix
pub label_prefix: Option<LabelPrefix>,
@@ -64,7 +69,9 @@ pub struct NetworkSelectConfig {
impl From<NetworkConfig> for Network {
fn from(value: NetworkConfig) -> Self {
let default_refresh_interval = 10;
let data_refresh_interval = value.data_refresh_interval.unwrap_or(10);
let data_refresh_interval = value
.data_refresh_interval
.unwrap_or(defaults::DATA_REFRESH_INTERVAL);
Self {
enable: value.enable,

View File

@@ -16,18 +16,27 @@ use std::time::Duration;
use std::time::Instant;
use sysinfo::Disks;
mod defaults {
pub const DATA_REFRESH_INTERVAL: u64 = 10;
pub const SHOW_READ_ONLY_DISKS: bool = false;
pub const SHOW_REMOVABLE_DISKS: bool = true;
}
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct StorageConfig {
/// Enable the Storage widget
pub enable: bool,
/// Data refresh interval (default: 10 seconds)
/// Data refresh interval in seconds
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::DATA_REFRESH_INTERVAL)))]
pub data_refresh_interval: Option<u64>,
/// Display label prefix
pub label_prefix: Option<LabelPrefix>,
/// Show disks that are read only. (default: false)
/// Show disks that are read only
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::SHOW_READ_ONLY_DISKS)))]
pub show_read_only_disks: Option<bool>,
/// Show removable disks. (default: true)
/// Show removable disks
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::SHOW_REMOVABLE_DISKS)))]
pub show_removable_disks: Option<bool>,
/// Select when the current percentage is over this value [[1-100]]
pub auto_select_over: Option<u8>,
@@ -40,10 +49,16 @@ impl From<StorageConfig> for Storage {
Self {
enable: value.enable,
disks: Disks::new_with_refreshed_list(),
data_refresh_interval: value.data_refresh_interval.unwrap_or(10),
data_refresh_interval: value
.data_refresh_interval
.unwrap_or(defaults::DATA_REFRESH_INTERVAL),
label_prefix: value.label_prefix.unwrap_or(LabelPrefix::IconAndText),
show_read_only_disks: value.show_read_only_disks.unwrap_or(false),
show_removable_disks: value.show_removable_disks.unwrap_or(true),
show_read_only_disks: value
.show_read_only_disks
.unwrap_or(defaults::SHOW_READ_ONLY_DISKS),
show_removable_disks: value
.show_removable_disks
.unwrap_or(defaults::SHOW_REMOVABLE_DISKS),
auto_select_over: value.auto_select_over.map(|o| o.clamp(1, 100)),
auto_hide_under: value.auto_hide_under.map(|o| o.clamp(1, 100)),
last_updated: Instant::now(),

View File

@@ -92,7 +92,7 @@ pub struct TimeConfig {
///}
/// ```
pub timezone: Option<String>,
/// Change the icon depending on the time. The default icon is used between 8:30 and 12:00. (default: false)
/// Change the icon depending on the time. The default icon is used between 8:30 and 12:00
pub changing_icon: Option<bool>,
}

View File

@@ -14,12 +14,17 @@ use std::process::Command;
use std::time::Duration;
use std::time::Instant;
mod defaults {
pub const DATA_REFRESH_INTERVAL: u64 = 12;
}
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct UpdateConfig {
/// Enable the Update widget
pub enable: bool,
/// Data refresh interval (default: 12 hours)
/// Data refresh interval in hours
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::DATA_REFRESH_INTERVAL)))]
pub data_refresh_interval: Option<u64>,
/// Display label prefix
pub label_prefix: Option<LabelPrefix>,
@@ -27,7 +32,9 @@ pub struct UpdateConfig {
impl From<UpdateConfig> for Update {
fn from(value: UpdateConfig) -> Self {
let data_refresh_interval = value.data_refresh_interval.unwrap_or(12);
let data_refresh_interval = value
.data_refresh_interval
.unwrap_or(defaults::DATA_REFRESH_INTERVAL);
let mut latest_version = String::new();

View File

@@ -106,6 +106,25 @@ use std::sync::atomic::Ordering;
use uds_windows::UnixListener;
use uds_windows::UnixStream;
mod defaults {
pub const RESIZE_DELTA: i32 = 50;
pub const BORDER_WIDTH: i32 = 8;
pub const BORDER_OFFSET: i32 = -1;
pub const BORDER_ENABLED: bool = true;
pub const TRANSPARENCY_ENABLED: bool = false;
pub const TRANSPARENCY_ALPHA: u8 = 200;
pub const DEFAULT_WORKSPACE_PADDING: i32 = 10;
pub const DEFAULT_CONTAINER_PADDING: i32 = 10;
pub const MOUSE_FOLLOWS_FOCUS: bool = true;
pub const FLOAT_OVERRIDE: bool = false;
pub const TILE: bool = true;
pub const APPLY_WINDOW_BASED_WORK_AREA_OFFSET: bool = true;
pub const WINDOW_BASED_WORK_AREA_OFFSET_LIMIT: isize = 1;
pub const GENERATE_THEME: bool = true;
pub const ANIMATION_FPS: u64 = 60;
pub const SLOW_APPLICATION_COMPENSATION_TIME: u64 = 20;
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct BorderColours {
@@ -132,38 +151,49 @@ pub struct BorderColours {
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct ThemeOptions {
/// Specify Light or Dark variant for theme generation (default: Dark)
/// Specify Light or Dark variant for theme generation
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::ThemeVariant::Dark)))]
pub theme_variant: Option<komorebi_themes::ThemeVariant>,
/// Border colour when the container contains a single window (default: Base0D)
/// Border colour when the container contains a single window
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0D)))]
pub single_border: Option<komorebi_themes::Base16Value>,
/// Border colour when the container contains multiple windows (default: Base0B)
/// Border colour when the container contains multiple windows
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0B)))]
pub stack_border: Option<komorebi_themes::Base16Value>,
/// Border colour when the container is in monocle mode (default: Base0F)
/// Border colour when the container is in monocle mode
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0F)))]
pub monocle_border: Option<komorebi_themes::Base16Value>,
/// Border colour when the window is floating (default: Base09)
/// Border colour when the window is floating
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base09)))]
pub floating_border: Option<komorebi_themes::Base16Value>,
/// Border colour when the container is unfocused (default: Base01)
/// Border colour when the container is unfocused
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base01)))]
pub unfocused_border: Option<komorebi_themes::Base16Value>,
/// Border colour when the container is unfocused and locked (default: Base08)
/// Border colour when the container is unfocused and locked
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base08)))]
pub unfocused_locked_border: Option<komorebi_themes::Base16Value>,
/// Stackbar focused tab text colour (default: Base0B)
/// Stackbar focused tab text colour
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0B)))]
pub stackbar_focused_text: Option<komorebi_themes::Base16Value>,
/// Stackbar unfocused tab text colour (default: Base05)
/// Stackbar unfocused tab text colour
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base05)))]
pub stackbar_unfocused_text: Option<komorebi_themes::Base16Value>,
/// Stackbar tab background colour (default: Base01)
/// Stackbar tab background colour
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base01)))]
pub stackbar_background: Option<komorebi_themes::Base16Value>,
/// Komorebi status bar accent (default: Base0D)
/// Komorebi status bar accent
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0D)))]
pub bar_accent: Option<komorebi_themes::Base16Value>,
}
@@ -174,11 +204,13 @@ pub struct Wallpaper {
/// Path to the wallpaper image file
#[serde_as(as = "ResolvedPathBuf")]
pub path: PathBuf,
/// Generate and apply Base16 theme for this wallpaper (default: true)
/// Generate and apply Base16 theme for this wallpaper
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::GENERATE_THEME)))]
pub generate_theme: Option<bool>,
/// Specify Light or Dark variant for theme generation (default: Dark)
/// Specify Light or Dark variant for theme generation
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::ThemeVariant::Dark)))]
pub theme_options: Option<ThemeOptions>,
}
@@ -189,21 +221,22 @@ pub struct Wallpaper {
pub struct WorkspaceConfig {
/// Name
pub name: String,
/// Layout (default: BSP)
/// Layout
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = DefaultLayout::BSP)))]
pub layout: Option<DefaultLayout>,
/// Layout-specific options (default: None)
/// Layout-specific options
#[serde(skip_serializing_if = "Option::is_none")]
pub layout_options: Option<LayoutOptions>,
/// END OF LIFE FEATURE: Custom Layout (default: None)
/// END OF LIFE FEATURE: Custom Layout
#[deprecated(note = "End of life feature")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde_as(as = "Option<ResolvedPathBuf>")]
pub custom_layout: Option<PathBuf>,
/// Layout rules in the format of threshold => layout (default: None)
/// Layout rules in the format of threshold => layout
#[serde(skip_serializing_if = "Option::is_none")]
pub layout_rules: Option<HashMap<usize, DefaultLayout>>,
/// END OF LIFE FEATURE: Custom layout rules (default: None)
/// END OF LIFE FEATURE: Custom layout rules
#[deprecated(note = "End of life feature")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "resolve_option_hashmap_usize_path", default)]
@@ -220,29 +253,34 @@ pub struct WorkspaceConfig {
/// Permanent workspace application rules
#[serde(skip_serializing_if = "Option::is_none")]
pub workspace_rules: Option<Vec<MatchingRule>>,
/// Workspace specific work area offset (default: None)
/// Workspace specific work area offset
#[serde(skip_serializing_if = "Option::is_none")]
pub work_area_offset: Option<Rect>,
/// Apply this monitor's window-based work area offset (default: true)
/// Apply this monitor's window-based work area offset
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::APPLY_WINDOW_BASED_WORK_AREA_OFFSET)))]
pub apply_window_based_work_area_offset: Option<bool>,
/// Determine what happens when a new window is opened (default: Create)
/// Determine what happens when a new window is opened
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = WindowContainerBehaviour::Create)))]
pub window_container_behaviour: Option<WindowContainerBehaviour>,
/// Window container behaviour rules in the format of threshold => behaviour (default: None)
/// Window container behaviour rules in the format of threshold => behaviour
#[serde(skip_serializing_if = "Option::is_none")]
pub window_container_behaviour_rules: Option<HashMap<usize, WindowContainerBehaviour>>,
/// Enable or disable float override, which makes it so every new window opens in floating mode (default: false)
/// Enable or disable float override, which makes it so every new window opens in floating mode
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::FLOAT_OVERRIDE)))]
pub float_override: Option<bool>,
/// Enable or disable tiling for the workspace (default: true)
/// Enable or disable tiling for the workspace
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::TILE)))]
pub tile: Option<bool>,
/// Specify an axis on which to flip the selected layout (default: None)
/// Specify an axis on which to flip the selected layout
#[serde(skip_serializing_if = "Option::is_none")]
pub layout_flip: Option<Axis>,
/// Determine what happens to a new window when the Floating workspace layer is active (default: Tile)
/// Determine what happens to a new window when the Floating workspace layer is active
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = FloatingLayerBehaviour::Tile)))]
pub floating_layer_behaviour: Option<FloatingLayerBehaviour>,
/// Specify a wallpaper for this workspace
#[serde(skip_serializing_if = "Option::is_none")]
@@ -340,14 +378,15 @@ impl From<&Workspace> for WorkspaceConfig {
pub struct MonitorConfig {
/// Workspace configurations
pub workspaces: Vec<WorkspaceConfig>,
/// Monitor-specific work area offset (default: None)
/// Monitor-specific work area offset
#[serde(skip_serializing_if = "Option::is_none")]
pub work_area_offset: Option<Rect>,
/// Window based work area offset (default: None)
/// Window based work area offset
#[serde(skip_serializing_if = "Option::is_none")]
pub window_based_work_area_offset: Option<Rect>,
/// Open window limit after which the window based work area offset will no longer be applied (default: 1)
/// Open window limit after which the window based work area offset will no longer be applied
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::WINDOW_BASED_WORK_AREA_OFFSET_LIMIT)))]
pub window_based_work_area_offset_limit: Option<isize>,
/// Container padding (default: global)
#[serde(skip_serializing_if = "Option::is_none")]
@@ -358,8 +397,9 @@ pub struct MonitorConfig {
/// Specify a wallpaper for this monitor
#[serde(skip_serializing_if = "Option::is_none")]
pub wallpaper: Option<Wallpaper>,
/// Determine what happens to a new window when the Floating workspace layer is active (default: Tile)
/// Determine what happens to a new window when the Floating workspace layer is active
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = FloatingLayerBehaviour::Tile)))]
pub floating_layer_behaviour: Option<FloatingLayerBehaviour>,
}
@@ -428,43 +468,49 @@ pub struct StaticConfig {
/// DISCOURAGED: Minimum height for a window to be eligible for tiling
#[serde(skip_serializing_if = "Option::is_none")]
pub minimum_window_height: Option<i32>,
/// Delta to resize windows by (default 50)
/// Delta to resize windows by
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::RESIZE_DELTA)))]
pub resize_delta: Option<i32>,
/// Determine what happens when a new window is opened (default: Create)
/// Determine what happens when a new window is opened
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = WindowContainerBehaviour::Create)))]
pub window_container_behaviour: Option<WindowContainerBehaviour>,
/// Enable or disable float override, which makes it so every new window opens in floating mode
/// (default: false)
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::FLOAT_OVERRIDE)))]
pub float_override: Option<bool>,
/// Determines what happens on a new window when on the `FloatingLayer`
/// (default: Tile)
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = FloatingLayerBehaviour::Tile)))]
pub floating_layer_behaviour: Option<FloatingLayerBehaviour>,
/// Determines the placement of a new window when toggling to float (default: CenterAndResize)
/// Determines the placement of a new window when toggling to float
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = Placement::CenterAndResize)))]
pub toggle_float_placement: Option<Placement>,
/// Determines the `Placement` to be used when spawning a window on the floating layer with the
/// `FloatingLayerBehaviour` set to `FloatingLayerBehaviour::Float` (default: Center)
/// `FloatingLayerBehaviour` set to `FloatingLayerBehaviour::Float`
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = Placement::Center)))]
pub floating_layer_placement: Option<Placement>,
/// Determines the `Placement` to be used when spawning a window with float override active
/// (default: None)
#[serde(skip_serializing_if = "Option::is_none")]
pub float_override_placement: Option<Placement>,
/// Determines the `Placement` to be used when spawning a window that matches a
/// `floating_applications` rule (default: None)
/// `floating_applications` rule
#[serde(skip_serializing_if = "Option::is_none")]
pub float_rule_placement: Option<Placement>,
/// Determine what happens when a window is moved across a monitor boundary (default: Swap)
/// Determine what happens when a window is moved across a monitor boundary
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = MoveBehaviour::Swap)))]
pub cross_monitor_move_behaviour: Option<MoveBehaviour>,
/// Determine what happens when an action is called on a window at a monitor boundary (default: Monitor)
/// Determine what happens when an action is called on a window at a monitor boundary
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = CrossBoundaryBehaviour::Monitor)))]
pub cross_boundary_behaviour: Option<CrossBoundaryBehaviour>,
/// Determine what happens when commands are sent while an unmanaged window is in the foreground (default: Op)
/// Determine what happens when commands are sent while an unmanaged window is in the foreground
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = OperationBehaviour::Op)))]
pub unmanaged_window_operation_behaviour: Option<OperationBehaviour>,
/// END OF LIFE FEATURE: Use https://github.com/LGUG2Z/masir instead
#[deprecated(
@@ -472,61 +518,72 @@ pub struct StaticConfig {
)]
#[serde(skip_serializing_if = "Option::is_none")]
pub focus_follows_mouse: Option<FocusFollowsMouseImplementation>,
/// Enable or disable mouse follows focus (default: true)
/// Enable or disable mouse follows focus
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::MOUSE_FOLLOWS_FOCUS)))]
pub mouse_follows_focus: Option<bool>,
/// Path to applications.json from komorebi-application-specific-configurations (default: None)
/// Path to applications.json from komorebi-application-specific-configurations
#[serde(skip_serializing_if = "Option::is_none")]
pub app_specific_configuration_path: Option<AppSpecificConfigurationPath>,
/// Width of window borders (default: 8)
/// Width of window borders
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(alias = "active_window_border_width")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::BORDER_WIDTH)))]
pub border_width: Option<i32>,
/// Offset of window borders (default: -1)
/// Offset of window borders
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(alias = "active_window_border_offset")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::BORDER_OFFSET)))]
pub border_offset: Option<i32>,
/// Display window borders (default: true)
/// Display window borders
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(alias = "active_window_border")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::BORDER_ENABLED)))]
pub border: Option<bool>,
/// Window border colours for different container types (has no effect if a theme is defined)
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(alias = "active_window_border_colours")]
pub border_colours: Option<BorderColours>,
/// Window border style (default: System)
/// Window border style
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(alias = "active_window_border_style")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = BorderStyle::System)))]
pub border_style: Option<BorderStyle>,
/// DEPRECATED from v0.1.31: no longer required
#[deprecated(note = "No longer required")]
#[serde(skip_serializing_if = "Option::is_none")]
pub border_z_order: Option<ZOrder>,
/// Window border implementation (default: Komorebi)
/// Window border implementation
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = BorderImplementation::Komorebi)))]
pub border_implementation: Option<BorderImplementation>,
/// Add transparency to unfocused windows (default: false)
/// Add transparency to unfocused windows
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::TRANSPARENCY_ENABLED)))]
pub transparency: Option<bool>,
/// Alpha value for unfocused window transparency [[0-255]] (default: 200)
/// Alpha value for unfocused window transparency [[0-255]]
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::TRANSPARENCY_ALPHA)))]
pub transparency_alpha: Option<u8>,
/// Individual window transparency ignore rules
#[serde(skip_serializing_if = "Option::is_none")]
pub transparency_ignore_rules: Option<Vec<MatchingRule>>,
/// Global default workspace padding (default: 10)
/// Global default workspace padding
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::DEFAULT_WORKSPACE_PADDING)))]
pub default_workspace_padding: Option<i32>,
/// Global default container padding (default: 10)
/// Global default container padding
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::DEFAULT_CONTAINER_PADDING)))]
pub default_container_padding: Option<i32>,
/// Monitor and workspace configurations
#[serde(skip_serializing_if = "Option::is_none")]
pub monitors: Option<Vec<MonitorConfig>>,
/// Which Windows signal to use when hiding windows (default: Cloak)
/// Which Windows signal to use when hiding windows
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = HidingBehaviour::Cloak)))]
pub window_hiding_behaviour: Option<HidingBehaviour>,
/// Global work area (space used for tiling) offset (default: None)
/// Global work area (space used for tiling) offset
#[serde(skip_serializing_if = "Option::is_none")]
pub global_work_area_offset: Option<Rect>,
/// Individual window floating rules
@@ -572,8 +629,9 @@ pub struct StaticConfig {
/// Identify applications which are slow to send initial event notifications
#[serde(skip_serializing_if = "Option::is_none")]
pub slow_application_identifiers: Option<Vec<MatchingRule>>,
/// How long to wait when compensating for slow applications, in milliseconds (default: 20)
/// How long to wait when compensating for slow applications, in milliseconds
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::SLOW_APPLICATION_COMPENSATION_TIME)))]
pub slow_application_compensation_time: Option<u64>,
/// Komorebi status bar configuration files for multiple instances on different monitors
// this option is a little special because it is only consumed by komorebic
@@ -586,24 +644,26 @@ pub struct StaticConfig {
/// Aspect ratio to resize with when toggling floating mode for a window
#[serde(skip_serializing_if = "Option::is_none")]
pub floating_window_aspect_ratio: Option<AspectRatio>,
/// Which Windows API behaviour to use when manipulating windows (default: Sync)
/// Which Windows API behaviour to use when manipulating windows
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = WindowHandlingBehaviour::Sync)))]
pub window_handling_behaviour: Option<WindowHandlingBehaviour>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct AnimationsConfig {
/// Enable or disable animations (default: false)
/// Enable or disable animations
pub enabled: PerAnimationPrefixConfig<bool>,
/// Set the animation duration in ms (default: 250)
/// Set the animation duration in ms
#[serde(skip_serializing_if = "Option::is_none")]
pub duration: Option<PerAnimationPrefixConfig<u64>>,
/// Set the animation style (default: Linear)
/// Set the animation style
#[serde(skip_serializing_if = "Option::is_none")]
pub style: Option<PerAnimationPrefixConfig<AnimationStyle>>,
/// Set the animation FPS (default: 60)
/// Set the animation FPS
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = defaults::ANIMATION_FPS)))]
pub fps: Option<u64>,
}
@@ -615,105 +675,135 @@ pub enum KomorebiTheme {
Catppuccin {
/// Name of the Catppuccin theme (theme previews: https://github.com/catppuccin/catppuccin)
name: komorebi_themes::Catppuccin,
/// Border colour when the container contains a single window (default: Blue)
/// Border colour when the container contains a single window
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::CatppuccinValue::Blue)))]
single_border: Option<komorebi_themes::CatppuccinValue>,
/// Border colour when the container contains multiple windows (default: Green)
/// Border colour when the container contains multiple windows
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::CatppuccinValue::Green)))]
stack_border: Option<komorebi_themes::CatppuccinValue>,
/// Border colour when the container is in monocle mode (default: Pink)
/// Border colour when the container is in monocle mode
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::CatppuccinValue::Pink)))]
monocle_border: Option<komorebi_themes::CatppuccinValue>,
/// Border colour when the window is floating (default: Yellow)
/// Border colour when the window is floating
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::CatppuccinValue::Yellow)))]
floating_border: Option<komorebi_themes::CatppuccinValue>,
/// Border colour when the container is unfocused (default: Base)
/// Border colour when the container is unfocused
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::CatppuccinValue::Base)))]
unfocused_border: Option<komorebi_themes::CatppuccinValue>,
/// Border colour when the container is unfocused and locked (default: Red)
/// Border colour when the container is unfocused and locked
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::CatppuccinValue::Red)))]
unfocused_locked_border: Option<komorebi_themes::CatppuccinValue>,
/// Stackbar focused tab text colour (default: Green)
/// Stackbar focused tab text colour
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::CatppuccinValue::Green)))]
stackbar_focused_text: Option<komorebi_themes::CatppuccinValue>,
/// Stackbar unfocused tab text colour (default: Text)
/// Stackbar unfocused tab text colour
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::CatppuccinValue::Text)))]
stackbar_unfocused_text: Option<komorebi_themes::CatppuccinValue>,
/// Stackbar tab background colour (default: Base)
/// Stackbar tab background colour
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::CatppuccinValue::Base)))]
stackbar_background: Option<komorebi_themes::CatppuccinValue>,
/// Komorebi status bar accent (default: Blue)
/// Komorebi status bar accent
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::CatppuccinValue::Blue)))]
bar_accent: Option<komorebi_themes::CatppuccinValue>,
},
/// A theme from base16-egui-themes
Base16 {
/// Name of the Base16 theme (theme previews: https://tinted-theming.github.io/tinted-gallery/)
name: komorebi_themes::Base16,
/// Border colour when the container contains a single window (default: Base0D)
/// Border colour when the container contains a single window
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0D)))]
single_border: Option<komorebi_themes::Base16Value>,
/// Border colour when the container contains multiple windows (default: Base0B)
/// Border colour when the container contains multiple windows
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0B)))]
stack_border: Option<komorebi_themes::Base16Value>,
/// Border colour when the container is in monocle mode (default: Base0F)
/// Border colour when the container is in monocle mode
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0F)))]
monocle_border: Option<komorebi_themes::Base16Value>,
/// Border colour when the window is floating (default: Base09)
/// Border colour when the window is floating
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base09)))]
floating_border: Option<komorebi_themes::Base16Value>,
/// Border colour when the container is unfocused (default: Base01)
/// Border colour when the container is unfocused
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base01)))]
unfocused_border: Option<komorebi_themes::Base16Value>,
/// Border colour when the container is unfocused and locked (default: Base08)
/// Border colour when the container is unfocused and locked
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base08)))]
unfocused_locked_border: Option<komorebi_themes::Base16Value>,
/// Stackbar focused tab text colour (default: Base0B)
/// Stackbar focused tab text colour
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0B)))]
stackbar_focused_text: Option<komorebi_themes::Base16Value>,
/// Stackbar unfocused tab text colour (default: Base05)
/// Stackbar unfocused tab text colour
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base05)))]
stackbar_unfocused_text: Option<komorebi_themes::Base16Value>,
/// Stackbar tab background colour (default: Base01)
/// Stackbar tab background colour
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base01)))]
stackbar_background: Option<komorebi_themes::Base16Value>,
/// Komorebi status bar accent (default: Base0D)
/// Komorebi status bar accent
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0D)))]
bar_accent: Option<komorebi_themes::Base16Value>,
},
/// A custom Base16 theme
Custom {
/// Colours of the custom Base16 theme palette
colours: Box<komorebi_themes::Base16ColourPalette>,
/// Border colour when the container contains a single window (default: Base0D)
/// Border colour when the container contains a single window
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0D)))]
single_border: Option<komorebi_themes::Base16Value>,
/// Border colour when the container contains multiple windows (default: Base0B)
/// Border colour when the container contains multiple windows
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0B)))]
stack_border: Option<komorebi_themes::Base16Value>,
/// Border colour when the container is in monocle mode (default: Base0F)
/// Border colour when the container is in monocle mode
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0F)))]
monocle_border: Option<komorebi_themes::Base16Value>,
/// Border colour when the window is floating (default: Base09)
/// Border colour when the window is floating
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base09)))]
floating_border: Option<komorebi_themes::Base16Value>,
/// Border colour when the container is unfocused (default: Base01)
/// Border colour when the container is unfocused
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base01)))]
unfocused_border: Option<komorebi_themes::Base16Value>,
/// Border colour when the container is unfocused and locked (default: Base08)
/// Border colour when the container is unfocused and locked
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base08)))]
unfocused_locked_border: Option<komorebi_themes::Base16Value>,
/// Stackbar focused tab text colour (default: Base0B)
/// Stackbar focused tab text colour
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0B)))]
stackbar_focused_text: Option<komorebi_themes::Base16Value>,
/// Stackbar unfocused tab text colour (default: Base05)
/// Stackbar unfocused tab text colour
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base05)))]
stackbar_unfocused_text: Option<komorebi_themes::Base16Value>,
/// Stackbar tab background colour (default: Base01)
/// Stackbar tab background colour
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base01)))]
stackbar_background: Option<komorebi_themes::Base16Value>,
/// Komorebi status bar accent (default: Base0D)
/// Komorebi status bar accent
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0D)))]
bar_accent: Option<komorebi_themes::Base16Value>,
},
}
@@ -835,8 +925,9 @@ pub struct StackbarConfig {
/// Stackbar label
#[serde(skip_serializing_if = "Option::is_none")]
pub label: Option<StackbarLabel>,
/// Stackbar mode (default: Never)
/// Stackbar mode
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "schemars", schemars(extend("default" = StackbarMode::Never)))]
pub mode: Option<StackbarMode>,
/// Stackbar tab configuration options
#[serde(skip_serializing_if = "Option::is_none")]
@@ -1040,9 +1131,18 @@ impl StaticConfig {
DEFAULT_WORKSPACE_PADDING.store(workspace, Ordering::SeqCst);
}
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);
border_manager::BORDER_ENABLED.store(self.border.unwrap_or(true), Ordering::SeqCst);
border_manager::BORDER_WIDTH.store(
self.border_width.unwrap_or(defaults::BORDER_WIDTH),
Ordering::SeqCst,
);
border_manager::BORDER_OFFSET.store(
self.border_offset.unwrap_or(defaults::BORDER_OFFSET),
Ordering::SeqCst,
);
border_manager::BORDER_ENABLED.store(
self.border.unwrap_or(defaults::BORDER_ENABLED),
Ordering::SeqCst,
);
if let Some(colours) = &self.border_colours {
if let Some(single) = colours.single {
@@ -1096,10 +1196,15 @@ impl StaticConfig {
border_manager::send_notification(None);
}
transparency_manager::TRANSPARENCY_ENABLED
.store(self.transparency.unwrap_or(false), Ordering::SeqCst);
transparency_manager::TRANSPARENCY_ALPHA
.store(self.transparency_alpha.unwrap_or(200), Ordering::SeqCst);
transparency_manager::TRANSPARENCY_ENABLED.store(
self.transparency.unwrap_or(defaults::TRANSPARENCY_ENABLED),
Ordering::SeqCst,
);
transparency_manager::TRANSPARENCY_ALPHA.store(
self.transparency_alpha
.unwrap_or(defaults::TRANSPARENCY_ALPHA),
Ordering::SeqCst,
);
let mut ignore_identifiers = IGNORE_IDENTIFIERS.lock();
let mut regex_identifiers = REGEX_IDENTIFIERS.lock();
@@ -1323,10 +1428,12 @@ impl StaticConfig {
unmanaged_window_operation_behaviour: value
.unmanaged_window_operation_behaviour
.unwrap_or(OperationBehaviour::Op),
resize_delta: value.resize_delta.unwrap_or(50),
resize_delta: value.resize_delta.unwrap_or(defaults::RESIZE_DELTA),
#[allow(deprecated)]
focus_follows_mouse: value.focus_follows_mouse,
mouse_follows_focus: value.mouse_follows_focus.unwrap_or(true),
mouse_follows_focus: value
.mouse_follows_focus
.unwrap_or(defaults::MOUSE_FOLLOWS_FOCUS),
hotwatch: Hotwatch::new()?,
has_pending_raise_op: false,
pending_move_op: Arc::new(None),
@@ -1416,7 +1523,7 @@ impl StaticConfig {
monitor_config.window_based_work_area_offset;
monitor.window_based_work_area_offset_limit = monitor_config
.window_based_work_area_offset_limit
.unwrap_or(1);
.unwrap_or(defaults::WINDOW_BASED_WORK_AREA_OFFSET_LIMIT);
monitor.container_padding = monitor_config.container_padding;
monitor.workspace_padding = monitor_config.workspace_padding;
monitor.wallpaper = monitor_config.wallpaper.clone();
@@ -1508,7 +1615,7 @@ impl StaticConfig {
m.window_based_work_area_offset = monitor_config.window_based_work_area_offset;
m.window_based_work_area_offset_limit = monitor_config
.window_based_work_area_offset_limit
.unwrap_or(1);
.unwrap_or(defaults::WINDOW_BASED_WORK_AREA_OFFSET_LIMIT);
m.container_padding = monitor_config.container_padding;
m.workspace_padding = monitor_config.workspace_padding;
m.floating_layer_behaviour = monitor_config.floating_layer_behaviour;
@@ -1589,7 +1696,7 @@ impl StaticConfig {
monitor_config.window_based_work_area_offset;
monitor.window_based_work_area_offset_limit = monitor_config
.window_based_work_area_offset_limit
.unwrap_or(1);
.unwrap_or(defaults::WINDOW_BASED_WORK_AREA_OFFSET_LIMIT);
monitor.container_padding = monitor_config.container_padding;
monitor.workspace_padding = monitor_config.workspace_padding;
monitor.wallpaper = monitor_config.wallpaper.clone();
@@ -1673,7 +1780,7 @@ impl StaticConfig {
m.window_based_work_area_offset = monitor_config.window_based_work_area_offset;
m.window_based_work_area_offset_limit = monitor_config
.window_based_work_area_offset_limit
.unwrap_or(1);
.unwrap_or(defaults::WINDOW_BASED_WORK_AREA_OFFSET_LIMIT);
m.container_padding = monitor_config.container_padding;
m.workspace_padding = monitor_config.workspace_padding;
m.floating_layer_behaviour = monitor_config.floating_layer_behaviour;
@@ -1693,7 +1800,10 @@ impl StaticConfig {
wm.enforce_workspace_rules()?;
border_manager::BORDER_ENABLED.store(value.border.unwrap_or(true), Ordering::SeqCst);
border_manager::BORDER_ENABLED.store(
value.border.unwrap_or(defaults::BORDER_ENABLED),
Ordering::SeqCst,
);
wm.window_management_behaviour.current_behaviour =
value.window_container_behaviour.unwrap_or_default();
wm.window_management_behaviour.float_override = value.float_override.unwrap_or_default();
@@ -1713,8 +1823,10 @@ impl StaticConfig {
wm.unmanaged_window_operation_behaviour = value
.unmanaged_window_operation_behaviour
.unwrap_or_default();
wm.resize_delta = value.resize_delta.unwrap_or(50);
wm.mouse_follows_focus = value.mouse_follows_focus.unwrap_or(true);
wm.resize_delta = value.resize_delta.unwrap_or(defaults::RESIZE_DELTA);
wm.mouse_follows_focus = value
.mouse_follows_focus
.unwrap_or(defaults::MOUSE_FOLLOWS_FOCUS);
wm.work_area_offset = value.global_work_area_offset;
#[allow(deprecated)]
{

View File

@@ -22,12 +22,13 @@
]
},
"font_size": {
"description": "Font size (default: 12.5)",
"description": "Font size",
"type": [
"number",
"null"
],
"format": "float"
"format": "float",
"default": 12.5
},
"frame": {
"description": "Frame options (see: https://docs.rs/egui/latest/egui/containers/frame/struct.Frame.html)",
@@ -52,20 +53,22 @@
]
},
"height": {
"description": "Bar height (default: 50)",
"description": "Bar height",
"type": [
"number",
"null"
],
"format": "float"
"format": "float",
"default": 50.0
},
"icon_scale": {
"description": "Scale of the icons relative to the font_size [[1.0-2.0]]. (default: 1.4)",
"description": "Scale of the icons relative to the font_size [[1.0-2.0]]",
"type": [
"number",
"null"
],
"format": "float"
"format": "float",
"default": 1.399999976158142
},
"left_widgets": {
"description": "Left side widgets (ordered left-to-right)",
@@ -86,12 +89,13 @@
]
},
"max_label_width": {
"description": "Max label width before text truncation (default: 400.0)",
"description": "Max label width before text truncation",
"type": [
"number",
"null"
],
"format": "float"
"format": "float",
"default": 400.0
},
"monitor": {
"description": "The monitor index or the full monitor options",
@@ -149,22 +153,24 @@
]
},
"transparency_alpha": {
"description": "Alpha value for the color transparency [[0-255]] (default: 200)",
"description": "Alpha value for the color transparency [[0-255]]",
"type": [
"integer",
"null"
],
"format": "uint8",
"default": 200,
"maximum": 255,
"minimum": 0
},
"widget_spacing": {
"description": "Spacing between widgets (default: 10.0)",
"description": "Spacing between widgets",
"type": [
"number",
"null"
],
"format": "float"
"format": "float",
"default": 10.0
}
},
"required": [
@@ -762,12 +768,13 @@
"minimum": 0
},
"data_refresh_interval": {
"description": "Data refresh interval (default: 10 seconds)",
"description": "Data refresh interval in seconds",
"type": [
"integer",
"null"
],
"format": "uint64",
"default": 10,
"minimum": 0
},
"enable": {
@@ -896,12 +903,13 @@
"minimum": 0
},
"data_refresh_interval": {
"description": "Data refresh interval (default: 10 seconds)",
"description": "Data refresh interval in seconds",
"type": [
"integer",
"null"
],
"format": "uint64",
"default": 10,
"minimum": 0
},
"enable": {
@@ -1346,12 +1354,13 @@
"type": "object",
"properties": {
"data_refresh_interval": {
"description": "Data refresh interval (default: 1 second)",
"description": "Data refresh interval",
"type": [
"integer",
"null"
],
"format": "uint64",
"default": 10,
"minimum": 0
},
"enable": {
@@ -1730,18 +1739,20 @@
"type": "object",
"properties": {
"focus_monitor_at_cursor": {
"description": "Send the FocusMonitorAtCursor message (default:true)",
"description": "Send the FocusMonitorAtCursor message",
"type": [
"boolean",
"null"
]
],
"default": true
},
"ignore_mouse_follows_focus": {
"description": "Wrap the {message} with a MouseFollowsFocus(false) and MouseFollowsFocus({original.value}) message (default:true)",
"description": "Wrap the {message} with a MouseFollowsFocus(false) and MouseFollowsFocus({original.value}) message",
"type": [
"boolean",
"null"
]
],
"default": true
},
"message": {
"description": "The message to send to the komorebi client",
@@ -1759,7 +1770,7 @@
"type": "object",
"properties": {
"bar_accent": {
"description": "Komorebi status bar accent (default: Blue)",
"description": "Komorebi status bar accent",
"anyOf": [
{
"$ref": "#/$defs/CatppuccinValue"
@@ -1767,10 +1778,11 @@
{
"type": "null"
}
]
],
"default": "Blue"
},
"floating_border": {
"description": "Border colour when the window is floating (default: Yellow)",
"description": "Border colour when the window is floating",
"anyOf": [
{
"$ref": "#/$defs/CatppuccinValue"
@@ -1778,10 +1790,11 @@
{
"type": "null"
}
]
],
"default": "Yellow"
},
"monocle_border": {
"description": "Border colour when the container is in monocle mode (default: Pink)",
"description": "Border colour when the container is in monocle mode",
"anyOf": [
{
"$ref": "#/$defs/CatppuccinValue"
@@ -1789,7 +1802,8 @@
{
"type": "null"
}
]
],
"default": "Pink"
},
"name": {
"description": "Name of the Catppuccin theme (theme previews: https://github.com/catppuccin/catppuccin)",
@@ -1800,7 +1814,7 @@
"const": "Catppuccin"
},
"single_border": {
"description": "Border colour when the container contains a single window (default: Blue)",
"description": "Border colour when the container contains a single window",
"anyOf": [
{
"$ref": "#/$defs/CatppuccinValue"
@@ -1808,10 +1822,11 @@
{
"type": "null"
}
]
],
"default": "Blue"
},
"stack_border": {
"description": "Border colour when the container contains multiple windows (default: Green)",
"description": "Border colour when the container contains multiple windows",
"anyOf": [
{
"$ref": "#/$defs/CatppuccinValue"
@@ -1819,10 +1834,11 @@
{
"type": "null"
}
]
],
"default": "Green"
},
"stackbar_background": {
"description": "Stackbar tab background colour (default: Base)",
"description": "Stackbar tab background colour",
"anyOf": [
{
"$ref": "#/$defs/CatppuccinValue"
@@ -1830,10 +1846,11 @@
{
"type": "null"
}
]
],
"default": "Base"
},
"stackbar_focused_text": {
"description": "Stackbar focused tab text colour (default: Green)",
"description": "Stackbar focused tab text colour",
"anyOf": [
{
"$ref": "#/$defs/CatppuccinValue"
@@ -1841,10 +1858,11 @@
{
"type": "null"
}
]
],
"default": "Green"
},
"stackbar_unfocused_text": {
"description": "Stackbar unfocused tab text colour (default: Text)",
"description": "Stackbar unfocused tab text colour",
"anyOf": [
{
"$ref": "#/$defs/CatppuccinValue"
@@ -1852,10 +1870,11 @@
{
"type": "null"
}
]
],
"default": "Text"
},
"unfocused_border": {
"description": "Border colour when the container is unfocused (default: Base)",
"description": "Border colour when the container is unfocused",
"anyOf": [
{
"$ref": "#/$defs/CatppuccinValue"
@@ -1863,10 +1882,11 @@
{
"type": "null"
}
]
],
"default": "Base"
},
"unfocused_locked_border": {
"description": "Border colour when the container is unfocused and locked (default: Red)",
"description": "Border colour when the container is unfocused and locked",
"anyOf": [
{
"$ref": "#/$defs/CatppuccinValue"
@@ -1874,7 +1894,8 @@
{
"type": "null"
}
]
],
"default": "Red"
}
},
"required": [
@@ -1887,7 +1908,7 @@
"type": "object",
"properties": {
"bar_accent": {
"description": "Komorebi status bar accent (default: Base0D)",
"description": "Komorebi status bar accent",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -1895,10 +1916,11 @@
{
"type": "null"
}
]
],
"default": "Base0D"
},
"floating_border": {
"description": "Border colour when the window is floating (default: Base09)",
"description": "Border colour when the window is floating",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -1906,10 +1928,11 @@
{
"type": "null"
}
]
],
"default": "Base09"
},
"monocle_border": {
"description": "Border colour when the container is in monocle mode (default: Base0F)",
"description": "Border colour when the container is in monocle mode",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -1917,7 +1940,8 @@
{
"type": "null"
}
]
],
"default": "Base0F"
},
"name": {
"description": "Name of the Base16 theme (theme previews: https://tinted-theming.github.io/tinted-gallery/)",
@@ -1928,7 +1952,7 @@
"const": "Base16"
},
"single_border": {
"description": "Border colour when the container contains a single window (default: Base0D)",
"description": "Border colour when the container contains a single window",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -1936,10 +1960,11 @@
{
"type": "null"
}
]
],
"default": "Base0D"
},
"stack_border": {
"description": "Border colour when the container contains multiple windows (default: Base0B)",
"description": "Border colour when the container contains multiple windows",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -1947,10 +1972,11 @@
{
"type": "null"
}
]
],
"default": "Base0B"
},
"stackbar_background": {
"description": "Stackbar tab background colour (default: Base01)",
"description": "Stackbar tab background colour",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -1958,10 +1984,11 @@
{
"type": "null"
}
]
],
"default": "Base01"
},
"stackbar_focused_text": {
"description": "Stackbar focused tab text colour (default: Base0B)",
"description": "Stackbar focused tab text colour",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -1969,10 +1996,11 @@
{
"type": "null"
}
]
],
"default": "Base0B"
},
"stackbar_unfocused_text": {
"description": "Stackbar unfocused tab text colour (default: Base05)",
"description": "Stackbar unfocused tab text colour",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -1980,10 +2008,11 @@
{
"type": "null"
}
]
],
"default": "Base05"
},
"unfocused_border": {
"description": "Border colour when the container is unfocused (default: Base01)",
"description": "Border colour when the container is unfocused",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -1991,10 +2020,11 @@
{
"type": "null"
}
]
],
"default": "Base01"
},
"unfocused_locked_border": {
"description": "Border colour when the container is unfocused and locked (default: Base08)",
"description": "Border colour when the container is unfocused and locked",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -2002,7 +2032,8 @@
{
"type": "null"
}
]
],
"default": "Base08"
}
},
"required": [
@@ -2015,7 +2046,7 @@
"type": "object",
"properties": {
"bar_accent": {
"description": "Komorebi status bar accent (default: Base0D)",
"description": "Komorebi status bar accent",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -2023,14 +2054,15 @@
{
"type": "null"
}
]
],
"default": "Base0D"
},
"colours": {
"description": "Colours of the custom Base16 theme palette",
"$ref": "#/$defs/Base16ColourPalette"
},
"floating_border": {
"description": "Border colour when the window is floating (default: Base09)",
"description": "Border colour when the window is floating",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -2038,10 +2070,11 @@
{
"type": "null"
}
]
],
"default": "Base09"
},
"monocle_border": {
"description": "Border colour when the container is in monocle mode (default: Base0F)",
"description": "Border colour when the container is in monocle mode",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -2049,14 +2082,15 @@
{
"type": "null"
}
]
],
"default": "Base0F"
},
"palette": {
"type": "string",
"const": "Custom"
},
"single_border": {
"description": "Border colour when the container contains a single window (default: Base0D)",
"description": "Border colour when the container contains a single window",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -2064,10 +2098,11 @@
{
"type": "null"
}
]
],
"default": "Base0D"
},
"stack_border": {
"description": "Border colour when the container contains multiple windows (default: Base0B)",
"description": "Border colour when the container contains multiple windows",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -2075,10 +2110,11 @@
{
"type": "null"
}
]
],
"default": "Base0B"
},
"stackbar_background": {
"description": "Stackbar tab background colour (default: Base01)",
"description": "Stackbar tab background colour",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -2086,10 +2122,11 @@
{
"type": "null"
}
]
],
"default": "Base01"
},
"stackbar_focused_text": {
"description": "Stackbar focused tab text colour (default: Base0B)",
"description": "Stackbar focused tab text colour",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -2097,10 +2134,11 @@
{
"type": "null"
}
]
],
"default": "Base0B"
},
"stackbar_unfocused_text": {
"description": "Stackbar unfocused tab text colour (default: Base05)",
"description": "Stackbar unfocused tab text colour",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -2108,10 +2146,11 @@
{
"type": "null"
}
]
],
"default": "Base05"
},
"unfocused_border": {
"description": "Border colour when the container is unfocused (default: Base01)",
"description": "Border colour when the container is unfocused",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -2119,10 +2158,11 @@
{
"type": "null"
}
]
],
"default": "Base01"
},
"unfocused_locked_border": {
"description": "Border colour when the container is unfocused and locked (default: Base08)",
"description": "Border colour when the container is unfocused and locked",
"anyOf": [
{
"$ref": "#/$defs/Base16Value"
@@ -2130,7 +2170,8 @@
{
"type": "null"
}
]
],
"default": "Base08"
}
},
"required": [
@@ -2248,12 +2289,13 @@
"minimum": 0
},
"data_refresh_interval": {
"description": "Data refresh interval (default: 10 seconds)",
"description": "Data refresh interval in seconds",
"type": [
"integer",
"null"
],
"format": "uint64",
"default": 10,
"minimum": 0
},
"enable": {
@@ -2319,12 +2361,13 @@
"type": "object",
"properties": {
"horizontal_scroll_threshold": {
"description": "Defines how many points a user needs to scroll horizontally to make a \"tick\" on a mouse/touchpad/touchscreen (default: 30)",
"description": "Defines how many points a user needs to scroll horizontally to make a \"tick\" on a mouse/touchpad/touchscreen",
"type": [
"number",
"null"
],
"format": "float"
"format": "float",
"default": 30.0
},
"on_extra1_click": {
"description": "Command to send on extra1/back button click",
@@ -2426,12 +2469,13 @@
]
},
"vertical_scroll_threshold": {
"description": "Defines how many points a user needs to scroll vertically to make a \"tick\" on a mouse/touchpad/touchscreen (default: 30)",
"description": "Defines how many points a user needs to scroll vertically to make a \"tick\" on a mouse/touchpad/touchscreen",
"type": [
"number",
"null"
],
"format": "float"
"format": "float",
"default": 30.0
}
}
},
@@ -2490,12 +2534,13 @@
]
},
"data_refresh_interval": {
"description": "Data refresh interval (default: 10 seconds)",
"description": "Data refresh interval in seconds",
"type": [
"integer",
"null"
],
"format": "uint64",
"default": 10,
"minimum": 0
},
"enable": {
@@ -6309,12 +6354,13 @@
"minimum": 0
},
"data_refresh_interval": {
"description": "Data refresh interval (default: 10 seconds)",
"description": "Data refresh interval in seconds",
"type": [
"integer",
"null"
],
"format": "uint64",
"default": 10,
"minimum": 0
},
"enable": {
@@ -6333,18 +6379,20 @@
]
},
"show_read_only_disks": {
"description": "Show disks that are read only. (default: false)",
"description": "Show disks that are read only",
"type": [
"boolean",
"null"
]
],
"default": false
},
"show_removable_disks": {
"description": "Show removable disks. (default: true)",
"description": "Show removable disks",
"type": [
"boolean",
"null"
]
],
"default": true
}
},
"required": [
@@ -6367,7 +6415,7 @@
"type": "object",
"properties": {
"changing_icon": {
"description": "Change the icon depending on the time. The default icon is used between 8:30 and 12:00. (default: false)",
"description": "Change the icon depending on the time. The default icon is used between 8:30 and 12:00",
"type": [
"boolean",
"null"
@@ -6456,12 +6504,13 @@
"type": "object",
"properties": {
"data_refresh_interval": {
"description": "Data refresh interval (default: 12 hours)",
"description": "Data refresh interval in hours",
"type": [
"integer",
"null"
],
"format": "uint64",
"default": 12,
"minimum": 0
},
"enable": {

File diff suppressed because it is too large Load Diff