summaryrefslogtreecommitdiff
path: root/lib/sway/structs.vala
diff options
context:
space:
mode:
authornoname <[email protected]>2025-03-07 17:46:09 +1100
committernoname <[email protected]>2025-03-07 17:46:09 +1100
commit3bee9424f314814e38149a2f98c1ff010797be9e (patch)
treedf800e8ca2b65f57bfed8313d0e044a440fc7c3f /lib/sway/structs.vala
parentf40a5c5aa8a5242190464c30521e9aca8e8dc2f0 (diff)
move stuffs to structs.vala
Diffstat (limited to 'lib/sway/structs.vala')
-rw-r--r--lib/sway/structs.vala56
1 files changed, 56 insertions, 0 deletions
diff --git a/lib/sway/structs.vala b/lib/sway/structs.vala
new file mode 100644
index 0000000..24e243b
--- /dev/null
+++ b/lib/sway/structs.vala
@@ -0,0 +1,56 @@
+namespace AstalSway {
+public enum PayloadType {
+ MESSAGE_RUN_COMMAND = 0,
+ MESSAGE_GET_WORKSPACES = 1,
+ MESSAGE_SUBSCRIBE = 2,
+ MESSAGE_GET_OUTPUTS = 3,
+ MESSAGE_GET_TREE = 4,
+ MESSAGE_GET_MARKS = 5,
+ MESSAGE_GET_BAR_CONFIG = 6,
+ MESSAGE_GET_VERSION = 7,
+ MESSAGE_GET_BINDING_NODES = 8,
+ MESSAGE_GET_CONFIG = 9,
+ MESSAGE_SEND_TICK = 10,
+ MESSAGE_SYNC = 11,
+ MESSAGE_GET_BINDING_STATE = 12,
+ MESSAGE_GET_INPUTS = 100,
+ MESSAGE_GET_SEATS = 101,
+ EVENT_WORKSPACE = 0x80000000,
+ EVENT_OUTPUT = 0x80000001,
+ EVENT_MODE = 0x80000002,
+ EVENT_WINDOW = 0x80000003,
+ EVENT_BARCONFIG_UPDATE = 0x80000004,
+ EVENT_BINDING = 0x80000005,
+ EVENT_SHUTDOWN = 0x80000006,
+ EVENT_TICK = 0x80000007,
+ EVENT_BAR_STATE_UPDATE = 0x80000014,
+ EVENT_INPUT = 0x80000015,
+}
+
+public enum NodeType {
+ ROOT,
+ WORKSPACE,
+ CONTAINER,
+ WINDOW,
+ OUTPUT,
+ SCRATCHPAD
+}
+
+public struct Rectangle {
+ internal static Rectangle from_json(Json.Object obj) {
+ return Rectangle() {
+ x = (int)obj.get_int_member("x"),
+ y = (int)obj.get_int_member("y"),
+ width = (int)obj.get_int_member("width"),
+ height = (int)obj.get_int_member("height"),
+ };
+
+ }
+
+ public int x;
+ public int y;
+ public int width;
+ public int height;
+}
+
+}