From 3efd1420de90dae789dde122d9a6cbc1c2f83ca6 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 30 Oct 2026 21:17:09 -0700 Subject: [PATCH] refactor(mac): converge the payload enums of core/mod.rs to the shared text The seven payload enums take the shared text (same as the Windows and KDE revisions): WindowKind gets the Windows variant docs, SubscribeOptions and StateQuery get the KDE docs, ApplicationIdentifier::Class gets the cfg_attr doc (macOS keeps 'Role or subrole'). The spelling of Move, MonocleFocus and OperationBehaviour was already the Windows one on macOS. komorebi-for-mac/schema.json needs no change: none of the changed docs is embedded in it (grep: WindowKind, SubscribeOptions, StateQuery are not in the schema; the four embedded descriptions are unchanged). Verified: fast-check macOS (fake CC) cargo check --workspace --all-targets: PASS. macOS tests not run (cannot). --- komorebi-for-mac/komorebi/src/core/mod.rs | 24 +++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/komorebi-for-mac/komorebi/src/core/mod.rs b/komorebi-for-mac/komorebi/src/core/mod.rs index d79df333..56670e31 100644 --- a/komorebi-for-mac/komorebi/src/core/mod.rs +++ b/komorebi-for-mac/komorebi/src/core/mod.rs @@ -210,11 +210,13 @@ pub enum ApplicationIdentifier { /// Executable name #[serde(alias = "exe")] Exe, - /// Role or subrole + // the description is part of the checked-in schemas, which differ per platform + #[cfg_attr(target_os = "windows", doc = " Class")] + #[cfg_attr(not(target_os = "windows"), doc = " Role or subrole")] #[serde(alias = "class")] Class, - /// Window title #[serde(alias = "title")] + /// Window title Title, /// Executable path #[serde(alias = "path")] @@ -236,16 +238,26 @@ pub enum ApplicationIdentifier { Hash, )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +/// What a window is to the layout, which decides the color of its border pub enum WindowKind { + /// Single window Single, + /// Stack container Stack, + /// Monocle container Monocle, #[default] + /// Unfocused window Unfocused, + /// Unfocused locked container UnfocusedLocked, + /// Floating window Floating, } +/// A question about the window manager that `SocketMessage::Query` asks, answered with one +/// value as text: an index, the name of a layout or of a container kind, or the version of the +/// daemon. #[derive(Copy, Clone, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum)] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub enum StateQuery { @@ -259,6 +271,14 @@ pub enum StateQuery { Version, } +/// The options of a subscriber, which `SocketMessage::AddSubscriberSocketWithOptions` sets +/// +/// A subscriber added with `SocketMessage::AddSubscriberSocket` has the default options, and is +/// sent a notification for every event and message the window manager handles. With +/// `filter_state_changes`, it is sent one only when the event or the message changed the +/// state, and always when a window is shown, when a subscriber is added (so a new subscriber +/// receives the state as soon as it subscribes), when a theme is set (the colors of the borders +/// are not part of the state) and when the configuration is reloaded. #[derive(Default, Debug, Copy, Clone, Eq, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SubscribeOptions {