feat(client): add more re-exports for integrations

This commit is a squashed commit of all the individual commits that made
up PR #1267 - adding various derives and re-exports aimed at improving
the komorebi integration surface for third party applications.
This commit is contained in:
alex-ds13
2024-12-22 10:42:03 +00:00
committed by LGUG2Z
parent bbd232f649
commit 86bbcac5ae
13 changed files with 148 additions and 37 deletions
Generated
+1 -1
View File
@@ -587,7 +587,7 @@ dependencies = [
[[package]] [[package]]
name = "base16-egui-themes" name = "base16-egui-themes"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/LGUG2Z/base16-egui-themes?rev=24362c4#24362c44459dc8e42c7c6080529c4cc719803d30" source = "git+https://github.com/LGUG2Z/base16-egui-themes?rev=911079d#911079d1ee7d60bbebf1f8e05d0e5a6bc596ad79"
dependencies = [ dependencies = [
"egui", "egui",
"schemars", "schemars",
+12
View File
@@ -2,10 +2,15 @@
#![allow(clippy::missing_errors_doc)] #![allow(clippy::missing_errors_doc)]
pub use komorebi::animation::prefix::AnimationPrefix; pub use komorebi::animation::prefix::AnimationPrefix;
pub use komorebi::animation::PerAnimationPrefixConfig;
pub use komorebi::asc::ApplicationSpecificConfiguration; pub use komorebi::asc::ApplicationSpecificConfiguration;
pub use komorebi::colour::Colour; pub use komorebi::colour::Colour;
pub use komorebi::colour::Rgb; pub use komorebi::colour::Rgb;
pub use komorebi::config_generation::ApplicationConfiguration; pub use komorebi::config_generation::ApplicationConfiguration;
pub use komorebi::config_generation::IdWithIdentifier;
pub use komorebi::config_generation::IdWithIdentifierAndComment;
pub use komorebi::config_generation::MatchingRule;
pub use komorebi::config_generation::MatchingStrategy;
pub use komorebi::container::Container; pub use komorebi::container::Container;
pub use komorebi::core::config_generation::ApplicationConfigurationGenerator; pub use komorebi::core::config_generation::ApplicationConfigurationGenerator;
pub use komorebi::core::resolve_home_path; pub use komorebi::core::resolve_home_path;
@@ -39,17 +44,24 @@ pub use komorebi::ring::Ring;
pub use komorebi::window::Window; pub use komorebi::window::Window;
pub use komorebi::window_manager_event::WindowManagerEvent; pub use komorebi::window_manager_event::WindowManagerEvent;
pub use komorebi::workspace::Workspace; pub use komorebi::workspace::Workspace;
pub use komorebi::AnimationsConfig;
pub use komorebi::AspectRatio;
pub use komorebi::BorderColours; pub use komorebi::BorderColours;
pub use komorebi::CrossBoundaryBehaviour;
pub use komorebi::GlobalState; pub use komorebi::GlobalState;
pub use komorebi::KomorebiTheme; pub use komorebi::KomorebiTheme;
pub use komorebi::MonitorConfig;
pub use komorebi::Notification; pub use komorebi::Notification;
pub use komorebi::NotificationEvent; pub use komorebi::NotificationEvent;
pub use komorebi::PredefinedAspectRatio;
pub use komorebi::RuleDebug; pub use komorebi::RuleDebug;
pub use komorebi::StackbarConfig; pub use komorebi::StackbarConfig;
pub use komorebi::State; pub use komorebi::State;
pub use komorebi::StaticConfig; pub use komorebi::StaticConfig;
pub use komorebi::SubscribeOptions; pub use komorebi::SubscribeOptions;
pub use komorebi::TabsConfig; pub use komorebi::TabsConfig;
pub use komorebi::WindowContainerBehaviour;
pub use komorebi::WorkspaceConfig;
use komorebi::DATA_DIR; use komorebi::DATA_DIR;
+1 -1
View File
@@ -4,7 +4,7 @@ version = "0.1.34"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
base16-egui-themes = { git = "https://github.com/LGUG2Z/base16-egui-themes", rev = "24362c4" } base16-egui-themes = { git = "https://github.com/LGUG2Z/base16-egui-themes", rev = "911079d" }
catppuccin-egui = { git = "https://github.com/LGUG2Z/catppuccin-egui", rev = "f85cc3c", default-features = false, features = ["egui30"] } catppuccin-egui = { git = "https://github.com/LGUG2Z/catppuccin-egui", rev = "f85cc3c", default-features = false, features = ["egui30"] }
#catppuccin-egui = { version = "5", default-features = false, features = ["egui30"] } #catppuccin-egui = { version = "5", default-features = false, features = ["egui30"] }
eframe = { workspace = true } eframe = { workspace = true }
+5 -4
View File
@@ -4,6 +4,7 @@
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::Deserialize; use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use strum::Display;
use strum::IntoEnumIterator; use strum::IntoEnumIterator;
pub use base16_egui_themes::Base16; pub use base16_egui_themes::Base16;
@@ -11,7 +12,7 @@ pub use catppuccin_egui;
pub use eframe::egui::Color32; pub use eframe::egui::Color32;
use serde_variant::to_variant_name; use serde_variant::to_variant_name;
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema)] #[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)]
#[serde(tag = "type")] #[serde(tag = "type")]
pub enum Theme { pub enum Theme {
/// A theme from catppuccin-egui /// A theme from catppuccin-egui
@@ -48,7 +49,7 @@ impl Theme {
} }
} }
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema)] #[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema, Display, PartialEq)]
pub enum Base16Value { pub enum Base16Value {
Base00, Base00,
Base01, Base01,
@@ -92,7 +93,7 @@ impl Base16Value {
} }
} }
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema)] #[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, Display, PartialEq)]
pub enum Catppuccin { pub enum Catppuccin {
Frappe, Frappe,
Latte, Latte,
@@ -117,7 +118,7 @@ impl From<Catppuccin> for catppuccin_egui::Theme {
} }
} }
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema)] #[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema, Display, PartialEq)]
pub enum CatppuccinValue { pub enum CatppuccinValue {
Rosewater, Rosewater,
Flamingo, Flamingo,
+1 -1
View File
@@ -22,7 +22,7 @@ use schemars::JsonSchema;
use serde::Deserialize; use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)] #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)]
#[serde(untagged)] #[serde(untagged)]
pub enum PerAnimationPrefixConfig<T> { pub enum PerAnimationPrefixConfig<T> {
Prefix(HashMap<AnimationPrefix, T>), Prefix(HashMap<AnimationPrefix, T>),
+2 -1
View File
@@ -29,6 +29,7 @@ use std::sync::atomic::AtomicU32;
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;
use std::sync::Arc; use std::sync::Arc;
use std::sync::OnceLock; use std::sync::OnceLock;
use strum::Display;
use windows::Win32::Graphics::Direct2D::ID2D1HwndRenderTarget; use windows::Win32::Graphics::Direct2D::ID2D1HwndRenderTarget;
pub static BORDER_WIDTH: AtomicI32 = AtomicI32::new(8); pub static BORDER_WIDTH: AtomicI32 = AtomicI32::new(8);
@@ -579,7 +580,7 @@ pub fn handle_notifications(wm: Arc<Mutex<WindowManager>>) -> color_eyre::Result
Ok(()) Ok(())
} }
#[derive(Debug, Copy, Clone, Serialize, Deserialize, JsonSchema)] #[derive(Debug, Copy, Clone, Display, Serialize, Deserialize, JsonSchema, PartialEq)]
pub enum ZOrder { pub enum ZOrder {
Top, Top,
NoTopMost, NoTopMost,
+3 -3
View File
@@ -8,7 +8,7 @@ use schemars::JsonSchema;
use serde::Deserialize; use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
#[derive(Debug, Copy, Clone, Serialize, Deserialize, JsonSchema)] #[derive(Debug, Copy, Clone, Serialize, Deserialize, JsonSchema, PartialEq)]
#[serde(untagged)] #[serde(untagged)]
pub enum Colour { pub enum Colour {
/// Colour represented as RGB /// Colour represented as RGB
@@ -51,7 +51,7 @@ impl From<Colour> for Color32 {
} }
} }
#[derive(Debug, Copy, Clone, Serialize, Deserialize)] #[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq)]
pub struct Hex(HexColor); pub struct Hex(HexColor);
impl JsonSchema for Hex { impl JsonSchema for Hex {
@@ -78,7 +78,7 @@ impl From<Colour> for u32 {
} }
} }
#[derive(Debug, Copy, Clone, Serialize, Deserialize, JsonSchema)] #[derive(Debug, Copy, Clone, Serialize, Deserialize, JsonSchema, PartialEq)]
pub struct Rgb { pub struct Rgb {
/// Red /// Red
pub r: u32, pub r: u32,
+10 -1
View File
@@ -6,7 +6,16 @@ use strum::Display;
use strum::EnumString; use strum::EnumString;
#[derive( #[derive(
Copy, Clone, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema, Copy,
Clone,
Debug,
Serialize,
Deserialize,
Display,
EnumString,
ValueEnum,
JsonSchema,
PartialEq,
)] )]
pub enum AnimationStyle { pub enum AnimationStyle {
Linear, Linear,
+1 -1
View File
@@ -75,7 +75,7 @@ pub struct IdWithIdentifier {
pub matching_strategy: Option<MatchingStrategy>, pub matching_strategy: Option<MatchingStrategy>,
} }
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, JsonSchema)] #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, Display, JsonSchema)]
pub enum MatchingStrategy { pub enum MatchingStrategy {
Legacy, Legacy,
Equals, Equals,
+20 -2
View File
@@ -432,7 +432,16 @@ pub enum MoveBehaviour {
} }
#[derive( #[derive(
Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema, Clone,
Copy,
Debug,
Serialize,
Deserialize,
Display,
EnumString,
ValueEnum,
JsonSchema,
PartialEq,
)] )]
pub enum CrossBoundaryBehaviour { pub enum CrossBoundaryBehaviour {
/// Attempt to perform actions across a workspace boundary /// Attempt to perform actions across a workspace boundary
@@ -442,7 +451,16 @@ pub enum CrossBoundaryBehaviour {
} }
#[derive( #[derive(
Copy, Clone, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema, Copy,
Clone,
Debug,
Serialize,
Deserialize,
Display,
EnumString,
ValueEnum,
JsonSchema,
PartialEq,
)] )]
pub enum HidingBehaviour { pub enum HidingBehaviour {
/// Use the SW_HIDE flag to hide windows when switching workspaces (has issues with Electron apps) /// Use the SW_HIDE flag to hide windows when switching workspaces (has issues with Electron apps)
+20
View File
@@ -118,6 +118,26 @@ pub fn new(
} }
impl Monitor { impl Monitor {
pub fn new(
id: isize,
size: Rect,
work_area_size: Rect,
name: String,
device: String,
device_id: String,
serial_number_id: Option<String>,
) -> Self {
new(
id,
size,
work_area_size,
name,
device,
device_id,
serial_number_id,
)
}
pub fn placeholder() -> Self { pub fn placeholder() -> Self {
Self { Self {
id: 0, id: 0,
+56 -19
View File
@@ -101,21 +101,26 @@ use std::sync::Arc;
use uds_windows::UnixListener; use uds_windows::UnixListener;
use uds_windows::UnixStream; use uds_windows::UnixStream;
#[derive(Debug, Serialize, Deserialize, JsonSchema)] #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)]
pub struct BorderColours { pub struct BorderColours {
/// Border colour when the container contains a single window /// Border colour when the container contains a single window
#[serde(skip_serializing_if = "Option::is_none")]
pub single: Option<Colour>, pub single: Option<Colour>,
/// Border colour when the container contains multiple windows /// Border colour when the container contains multiple windows
#[serde(skip_serializing_if = "Option::is_none")]
pub stack: Option<Colour>, pub stack: Option<Colour>,
/// Border colour when the container is in monocle mode /// Border colour when the container is in monocle mode
#[serde(skip_serializing_if = "Option::is_none")]
pub monocle: Option<Colour>, pub monocle: Option<Colour>,
/// Border colour when the container is in floating mode /// Border colour when the container is in floating mode
#[serde(skip_serializing_if = "Option::is_none")]
pub floating: Option<Colour>, pub floating: Option<Colour>,
/// Border colour when the container is unfocused /// Border colour when the container is unfocused
#[serde(skip_serializing_if = "Option::is_none")]
pub unfocused: Option<Colour>, pub unfocused: Option<Colour>,
} }
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq)]
pub struct WorkspaceConfig { pub struct WorkspaceConfig {
/// Name /// Name
pub name: String, pub name: String,
@@ -223,7 +228,7 @@ impl From<&Workspace> for WorkspaceConfig {
} }
} }
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq)]
pub struct MonitorConfig { pub struct MonitorConfig {
/// Workspace configurations /// Workspace configurations
pub workspaces: Vec<WorkspaceConfig>, pub workspaces: Vec<WorkspaceConfig>,
@@ -254,7 +259,7 @@ impl From<&Monitor> for MonitorConfig {
} }
} }
#[derive(Debug, Serialize, Deserialize, JsonSchema)] #[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq)]
/// The `komorebi.json` static configuration file reference for `v0.1.34` /// The `komorebi.json` static configuration file reference for `v0.1.34`
pub struct StaticConfig { pub struct StaticConfig {
/// DEPRECATED from v0.1.22: no longer required /// DEPRECATED from v0.1.22: no longer required
@@ -391,8 +396,8 @@ pub struct StaticConfig {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub slow_application_compensation_time: Option<u64>, pub slow_application_compensation_time: Option<u64>,
/// Komorebi status bar configuration files for multiple instances on different monitors /// Komorebi status bar configuration files for multiple instances on different monitors
#[serde(skip_serializing_if = "Option::is_none")]
// this option is a little special because it is only consumed by komorebic // this option is a little special because it is only consumed by komorebic
#[serde(skip_serializing_if = "Option::is_none")]
pub bar_configurations: Option<Vec<PathBuf>>, pub bar_configurations: Option<Vec<PathBuf>>,
/// HEAVILY DISCOURAGED: Identify applications for which komorebi should forcibly remove title bars /// HEAVILY DISCOURAGED: Identify applications for which komorebi should forcibly remove title bars
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@@ -402,18 +407,22 @@ pub struct StaticConfig {
pub floating_window_aspect_ratio: Option<AspectRatio>, pub floating_window_aspect_ratio: Option<AspectRatio>,
} }
#[derive(Debug, Serialize, Deserialize, JsonSchema)] #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)]
pub struct AnimationsConfig { pub struct AnimationsConfig {
/// Enable or disable animations (default: false) /// Enable or disable animations (default: false)
enabled: PerAnimationPrefixConfig<bool>, pub enabled: PerAnimationPrefixConfig<bool>,
/// Set the animation duration in ms (default: 250) /// Set the animation duration in ms (default: 250)
duration: Option<PerAnimationPrefixConfig<u64>>, #[serde(skip_serializing_if = "Option::is_none")]
pub duration: Option<PerAnimationPrefixConfig<u64>>,
/// Set the animation style (default: Linear) /// Set the animation style (default: Linear)
style: Option<PerAnimationPrefixConfig<AnimationStyle>>, #[serde(skip_serializing_if = "Option::is_none")]
pub style: Option<PerAnimationPrefixConfig<AnimationStyle>>,
/// Set the animation FPS (default: 60) /// Set the animation FPS (default: 60)
fps: Option<u64>, #[serde(skip_serializing_if = "Option::is_none")]
pub fps: Option<u64>,
} }
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema)]
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)]
#[serde(tag = "palette")] #[serde(tag = "palette")]
pub enum KomorebiTheme { pub enum KomorebiTheme {
/// A theme from catppuccin-egui /// A theme from catppuccin-egui
@@ -421,22 +430,31 @@ pub enum KomorebiTheme {
/// Name of the Catppuccin theme (theme previews: https://github.com/catppuccin/catppuccin) /// Name of the Catppuccin theme (theme previews: https://github.com/catppuccin/catppuccin)
name: komorebi_themes::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 (default: Blue)
#[serde(skip_serializing_if = "Option::is_none")]
single_border: Option<komorebi_themes::CatppuccinValue>, single_border: Option<komorebi_themes::CatppuccinValue>,
/// Border colour when the container contains multiple windows (default: Green) /// Border colour when the container contains multiple windows (default: Green)
#[serde(skip_serializing_if = "Option::is_none")]
stack_border: Option<komorebi_themes::CatppuccinValue>, 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 (default: Pink)
#[serde(skip_serializing_if = "Option::is_none")]
monocle_border: Option<komorebi_themes::CatppuccinValue>, monocle_border: Option<komorebi_themes::CatppuccinValue>,
/// Border colour when the window is floating (default: Yellow) /// Border colour when the window is floating (default: Yellow)
#[serde(skip_serializing_if = "Option::is_none")]
floating_border: Option<komorebi_themes::CatppuccinValue>, floating_border: Option<komorebi_themes::CatppuccinValue>,
/// Border colour when the container is unfocused (default: Base) /// Border colour when the container is unfocused (default: Base)
#[serde(skip_serializing_if = "Option::is_none")]
unfocused_border: Option<komorebi_themes::CatppuccinValue>, unfocused_border: Option<komorebi_themes::CatppuccinValue>,
/// Stackbar focused tab text colour (default: Green) /// Stackbar focused tab text colour (default: Green)
#[serde(skip_serializing_if = "Option::is_none")]
stackbar_focused_text: Option<komorebi_themes::CatppuccinValue>, stackbar_focused_text: Option<komorebi_themes::CatppuccinValue>,
/// Stackbar unfocused tab text colour (default: Text) /// Stackbar unfocused tab text colour (default: Text)
#[serde(skip_serializing_if = "Option::is_none")]
stackbar_unfocused_text: Option<komorebi_themes::CatppuccinValue>, stackbar_unfocused_text: Option<komorebi_themes::CatppuccinValue>,
/// Stackbar tab background colour (default: Base) /// Stackbar tab background colour (default: Base)
#[serde(skip_serializing_if = "Option::is_none")]
stackbar_background: Option<komorebi_themes::CatppuccinValue>, stackbar_background: Option<komorebi_themes::CatppuccinValue>,
/// Komorebi status bar accent (default: Blue) /// Komorebi status bar accent (default: Blue)
#[serde(skip_serializing_if = "Option::is_none")]
bar_accent: Option<komorebi_themes::CatppuccinValue>, bar_accent: Option<komorebi_themes::CatppuccinValue>,
}, },
/// A theme from base16-egui-themes /// A theme from base16-egui-themes
@@ -444,22 +462,31 @@ pub enum KomorebiTheme {
/// Name of the Base16 theme (theme previews: https://tinted-theming.github.io/tinted-gallery/) /// Name of the Base16 theme (theme previews: https://tinted-theming.github.io/tinted-gallery/)
name: komorebi_themes::Base16, name: komorebi_themes::Base16,
/// Border colour when the container contains a single window (default: Base0D) /// Border colour when the container contains a single window (default: Base0D)
#[serde(skip_serializing_if = "Option::is_none")]
single_border: Option<komorebi_themes::Base16Value>, single_border: Option<komorebi_themes::Base16Value>,
/// Border colour when the container contains multiple windows (default: Base0B) /// Border colour when the container contains multiple windows (default: Base0B)
#[serde(skip_serializing_if = "Option::is_none")]
stack_border: Option<komorebi_themes::Base16Value>, 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 (default: Base0F)
#[serde(skip_serializing_if = "Option::is_none")]
monocle_border: Option<komorebi_themes::Base16Value>, monocle_border: Option<komorebi_themes::Base16Value>,
/// Border colour when the window is floating (default: Base09) /// Border colour when the window is floating (default: Base09)
#[serde(skip_serializing_if = "Option::is_none")]
floating_border: Option<komorebi_themes::Base16Value>, floating_border: Option<komorebi_themes::Base16Value>,
/// Border colour when the container is unfocused (default: Base01) /// Border colour when the container is unfocused (default: Base01)
#[serde(skip_serializing_if = "Option::is_none")]
unfocused_border: Option<komorebi_themes::Base16Value>, unfocused_border: Option<komorebi_themes::Base16Value>,
/// Stackbar focused tab text colour (default: Base0B) /// Stackbar focused tab text colour (default: Base0B)
#[serde(skip_serializing_if = "Option::is_none")]
stackbar_focused_text: Option<komorebi_themes::Base16Value>, stackbar_focused_text: Option<komorebi_themes::Base16Value>,
/// Stackbar unfocused tab text colour (default: Base05) /// Stackbar unfocused tab text colour (default: Base05)
#[serde(skip_serializing_if = "Option::is_none")]
stackbar_unfocused_text: Option<komorebi_themes::Base16Value>, stackbar_unfocused_text: Option<komorebi_themes::Base16Value>,
/// Stackbar tab background colour (default: Base01) /// Stackbar tab background colour (default: Base01)
#[serde(skip_serializing_if = "Option::is_none")]
stackbar_background: Option<komorebi_themes::Base16Value>, stackbar_background: Option<komorebi_themes::Base16Value>,
/// Komorebi status bar accent (default: Base0D) /// Komorebi status bar accent (default: Base0D)
#[serde(skip_serializing_if = "Option::is_none")]
bar_accent: Option<komorebi_themes::Base16Value>, bar_accent: Option<komorebi_themes::Base16Value>,
}, },
} }
@@ -545,31 +572,41 @@ impl StaticConfig {
} }
} }
#[derive(Debug, Serialize, Deserialize, JsonSchema)] #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)]
pub struct TabsConfig { pub struct TabsConfig {
/// Width of a stackbar tab /// Width of a stackbar tab
width: Option<i32>, #[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i32>,
/// Focused tab text colour /// Focused tab text colour
focused_text: Option<Colour>, #[serde(skip_serializing_if = "Option::is_none")]
pub focused_text: Option<Colour>,
/// Unfocused tab text colour /// Unfocused tab text colour
unfocused_text: Option<Colour>, #[serde(skip_serializing_if = "Option::is_none")]
pub unfocused_text: Option<Colour>,
/// Tab background colour /// Tab background colour
background: Option<Colour>, #[serde(skip_serializing_if = "Option::is_none")]
pub background: Option<Colour>,
/// Font family /// Font family
font_family: Option<String>, #[serde(skip_serializing_if = "Option::is_none")]
pub font_family: Option<String>,
/// Font size /// Font size
font_size: Option<i32>, #[serde(skip_serializing_if = "Option::is_none")]
pub font_size: Option<i32>,
} }
#[derive(Debug, Serialize, Deserialize, JsonSchema)] #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)]
pub struct StackbarConfig { pub struct StackbarConfig {
/// Stackbar height /// Stackbar height
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i32>, pub height: Option<i32>,
/// Stackbar label /// Stackbar label
#[serde(skip_serializing_if = "Option::is_none")]
pub label: Option<StackbarLabel>, pub label: Option<StackbarLabel>,
/// Stackbar mode /// Stackbar mode
#[serde(skip_serializing_if = "Option::is_none")]
pub mode: Option<StackbarMode>, pub mode: Option<StackbarMode>,
/// Stackbar tab configuration options /// Stackbar tab configuration options
#[serde(skip_serializing_if = "Option::is_none")]
pub tabs: Option<TabsConfig>, pub tabs: Option<TabsConfig>,
} }
+15 -2
View File
@@ -40,6 +40,8 @@ use serde::ser::SerializeStruct;
use serde::Deserialize; use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use serde::Serializer; use serde::Serializer;
use strum::Display;
use strum::EnumString;
use windows::Win32::Foundation::HWND; use windows::Win32::Foundation::HWND;
use crate::core::ApplicationIdentifier; use crate::core::ApplicationIdentifier;
@@ -297,7 +299,9 @@ impl RenderDispatcher for TransparencyRenderDispatcher {
} }
} }
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema)] #[derive(
Copy, Clone, Debug, Display, EnumString, Serialize, Deserialize, JsonSchema, PartialEq,
)]
#[serde(untagged)] #[serde(untagged)]
pub enum AspectRatio { pub enum AspectRatio {
/// A predefined aspect ratio /// A predefined aspect ratio
@@ -306,13 +310,22 @@ pub enum AspectRatio {
Custom(i32, i32), Custom(i32, i32),
} }
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema)] impl Default for AspectRatio {
fn default() -> Self {
AspectRatio::Predefined(PredefinedAspectRatio::default())
}
}
#[derive(
Copy, Clone, Debug, Default, Display, EnumString, Serialize, Deserialize, JsonSchema, PartialEq,
)]
pub enum PredefinedAspectRatio { pub enum PredefinedAspectRatio {
/// 21:9 /// 21:9
Ultrawide, Ultrawide,
/// 16:9 /// 16:9
Widescreen, Widescreen,
/// 4:3 /// 4:3
#[default]
Standard, Standard,
} }