Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

feat: add active drag field to window dto

Lars Berger138bfe250f80
diff --git a/packages/wm/src/windows/active_drag.rs b/packages/wm/src/windows/active_drag.rs
index d54035c1..b6199c72 100644
--- a/packages/wm/src/windows/active_drag.rs
+++ b/packages/wm/src/windows/active_drag.rs
@@ -1,10 +1,12 @@
-#[derive(Debug, Clone, Default)]
+use serde::{Deserialize, Serialize};
+
+#[derive(Debug, Clone, Default, Deserialize, Serialize)]
pub struct ActiveDrag {
pub operation: Option<ActiveDragOperation>,
pub is_from_tiling: bool,
}
-#[derive(Debug, Copy, Clone, PartialEq)]
+#[derive(Debug, Copy, Clone, Deserialize, PartialEq, Serialize)]
pub enum ActiveDragOperation {
Moving,
Resizing,
diff --git a/packages/wm/src/windows/non_tiling_window.rs b/packages/wm/src/windows/non_tiling_window.rs
index 173c3261..63f46dcc 100644
--- a/packages/wm/src/windows/non_tiling_window.rs
+++ b/packages/wm/src/windows/non_tiling_window.rs
@@ -120,6 +120,7 @@ impl NonTilingWindow {
title: self.native().title()?,
class_name: self.native().class_name()?,
process_name: self.native().process_name()?,
+ active_drag: self.active_drag(),
}))
}
}
diff --git a/packages/wm/src/windows/tiling_window.rs b/packages/wm/src/windows/tiling_window.rs
index c0fdd65d..da073458 100644
--- a/packages/wm/src/windows/tiling_window.rs
+++ b/packages/wm/src/windows/tiling_window.rs
@@ -122,6 +122,7 @@ impl TilingWindow {
title: self.native().title()?,
class_name: self.native().class_name()?,
process_name: self.native().process_name()?,
+ active_drag: self.active_drag(),
}))
}
}
diff --git a/packages/wm/src/windows/window_dto.rs b/packages/wm/src/windows/window_dto.rs
index 38268d90..ff127981 100644
--- a/packages/wm/src/windows/window_dto.rs
+++ b/packages/wm/src/windows/window_dto.rs
@@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};
use uuid::Uuid;
-use super::WindowState;
+use super::{ActiveDrag, WindowState};
use crate::common::{DisplayState, Rect, RectDelta};
/// User-friendly representation of a tiling or non-tiling window.
@@ -27,4 +27,5 @@ pub struct WindowDto {
pub title: String,
pub class_name: String,
pub process_name: String,
+ pub active_drag: Option<ActiveDrag>,
}