From 3603926f0eba30d44950d1081b4cb99736e1e5fb Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 31 Oct 2026 10:55:26 -0700 Subject: [PATCH] refactor(kde): order monitor.rs like the Windows monitor Pure move, no behaviour change: struct Monitor first, then impl_ring_elements!, then MonitorInformation and its From impl, as in komorebi/src/monitor.rs. Field order and field sets are untouched (the derive order is the JSON order of the state, and Windows' extra fields name, device_id and workspace_names are content, not layout; see docs/dev/core-model.md). Verified: KDE cargo test -p komorebi --lib --tests (native): 633 passed, 0 failed. Not run: doc tests, VM suites. --- komorebi-for-kde/komorebi/src/monitor.rs | 46 ++++++++++++------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/komorebi-for-kde/komorebi/src/monitor.rs b/komorebi-for-kde/komorebi/src/monitor.rs index 492acd97..c1698d86 100644 --- a/komorebi-for-kde/komorebi/src/monitor.rs +++ b/komorebi-for-kde/komorebi/src/monitor.rs @@ -37,29 +37,6 @@ use serde::Serialize; use std::collections::VecDeque; use std::sync::atomic::Ordering; -/// A monitor's identity and bounds, as the daemon answers -/// [`SocketMessage::MonitorInformation`](crate::core::SocketMessage::MonitorInformation) with them -#[derive(Debug, Serialize, Deserialize)] -pub struct MonitorInformation { - pub id: u32, - pub device: String, - pub serial_number_id: String, - pub size: Rect, -} - -impl From<&Monitor> for MonitorInformation { - fn from(value: &Monitor) -> Self { - Self { - id: value.id, - device: value.device.clone(), - serial_number_id: value.serial_number_id.clone(), - size: value.size, - } - } -} - -impl_ring_elements!(Monitor, Workspace); - #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Monitor { @@ -85,6 +62,29 @@ pub struct Monitor { pub floating_layer_behaviour: Option, } +impl_ring_elements!(Monitor, Workspace); + +/// A monitor's identity and bounds, as the daemon answers +/// [`SocketMessage::MonitorInformation`](crate::core::SocketMessage::MonitorInformation) with them +#[derive(Debug, Serialize, Deserialize)] +pub struct MonitorInformation { + pub id: u32, + pub device: String, + pub serial_number_id: String, + pub size: Rect, +} + +impl From<&Monitor> for MonitorInformation { + fn from(value: &Monitor) -> Self { + Self { + id: value.id, + device: value.device.clone(), + serial_number_id: value.serial_number_id.clone(), + size: value.size, + } + } +} + /// Returns a monitor with one empty workspace, the way [`Monitor::new`] makes one, from owned /// names pub fn new(