refactor(kde): converge the payload enums of core/mod.rs to the shared text

The seven payload enums take the shared text (same one as the Windows revision): the Windows docs of WindowKind's variants, the Windows spelling 'behaviour' in MoveBehaviour, MonocleFocusBehaviour and OperationBehaviour, and the cfg_attr doc of ApplicationIdentifier::Class (KDE keeps 'Role or subrole'). The SubscribeOptions doc loses its doctest and its intra-doc links here; the example comes back in the crate when the type moves, and an example with SocketMessage when that moves.

Intentional schema change, description only: komorebi-for-kde/schema.json spells behaviour in three descriptions (monocle focus, move, operation). Regenerated with komorebic static-config-schema and compared with the checked-in file: identical; schema.asc.json also identical to a regeneration.

Verified: cargo test -p komorebi --lib --test schemas in komorebi-for-kde: 302 + 5 passed, 0 failed; --doc: 44 + 2 passed (one doctest fewer: SubscribeOptions).
This commit is contained in:
LGUG2Z committed 2026-10-31 01:37:53 -07:00
1 parent f4a58eb5c7
commit c586257e57
2 files changed
+23 -35

No files matched your search

+20 -32
View File
@@ -59,7 +59,7 @@ pub use komorebi_protocol::pathext;
Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize, Display, EnumString, ValueEnum,
)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
/// Operation behavior for temporarily unmanaged and floating windows
/// Operation behaviour for temporarily unmanaged and floating windows
pub enum OperationBehaviour {
/// Process commands on temporarily unmanaged/floated windows
#[default]
@@ -398,7 +398,7 @@ pub enum PlacementMatchingRules {
Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize, Display, EnumString, ValueEnum,
)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
/// Move behavior when the operation works across a monitor boundary
/// Move behaviour when the operation works across a monitor boundary
pub enum MoveBehaviour {
/// Swap the window container with the window container at the edge of the adjacent monitor
#[default]
@@ -426,7 +426,7 @@ pub enum CrossBoundaryBehaviour {
Clone, Copy, Debug, Default, Serialize, Deserialize, Display, EnumString, ValueEnum, PartialEq,
)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
/// Behavior when focusing in a direction while a monocle container is active
/// Behaviour when focusing in a direction while a monocle container is active
pub enum MonocleFocusBehaviour {
/// Cycle the monocle container to the next/previous container in the workspace
Cycle,
@@ -444,18 +444,19 @@ 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")]
Path,
}
/// What a window is to the layout, which decides the color of its border
#[derive(
Copy,
Clone,
@@ -471,17 +472,24 @@ 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
/// 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)]
@@ -497,34 +505,14 @@ pub enum StateQuery {
Version,
}
/// The options of a subscriber, which [`SocketMessage::AddSubscriberSocketWithOptions`] sets
/// The options of a subscriber, which `SocketMessage::AddSubscriberSocketWithOptions` sets
///
/// A subscriber added with [`SocketMessage::AddSubscriberSocket`] has the default options, and is
/// 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`](crate::state::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.
///
/// # Example
///
/// ```rust
/// use komorebi::core::SocketMessage;
/// use komorebi::core::SubscribeOptions;
///
/// let options = SubscribeOptions {
/// filter_state_changes: true,
/// };
/// let message = SocketMessage::AddSubscriberSocketWithOptions(String::from("bar.sock"), options);
/// assert_eq!(
/// String::from_utf8(message.as_bytes()?)?,
/// r#"{"type":"AddSubscriberSocketWithOptions","content":["bar.sock",{"filter_state_changes":true}]}"#,
/// );
///
/// assert!(!SubscribeOptions::default().filter_state_changes);
///
/// # Ok::<(), Box<dyn std::error::Error>>(())
/// ```
/// 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 {
+3 -3
View File
@@ -3257,7 +3257,7 @@
]
},
"MonocleFocusBehaviour": {
"description": "Behavior when focusing in a direction while a monocle container is active",
"description": "Behaviour when focusing in a direction while a monocle container is active",
"oneOf": [
{
"description": "Cycle the monocle container to the next/previous container in the workspace",
@@ -3272,7 +3272,7 @@
]
},
"MoveBehaviour": {
"description": "Move behavior when the operation works across a monitor boundary",
"description": "Move behaviour when the operation works across a monitor boundary",
"oneOf": [
{
"description": "Swap the window container with the window container at the edge of the adjacent monitor",
@@ -3292,7 +3292,7 @@
]
},
"OperationBehaviour": {
"description": "Operation behavior for temporarily unmanaged and floating windows",
"description": "Operation behaviour for temporarily unmanaged and floating windows",
"oneOf": [
{
"description": "Process commands on temporarily unmanaged/floated windows",