From 87574a40e3477bbd140685e6fa502485efdf1b70 Mon Sep 17 00:00:00 2001 From: Ottatop Date: Thu, 19 Oct 2023 20:00:46 -0500 Subject: [PATCH] Add remaining window methods --- api/rust/src/window.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/api/rust/src/window.rs b/api/rust/src/window.rs index 0d09c19..7597420 100644 --- a/api/rust/src/window.rs +++ b/api/rust/src/window.rs @@ -1,6 +1,8 @@ use crate::{ msg::{FullscreenOrMaximized, Msg, Request, RequestResponse, WindowId}, request, send_msg, + tag::TagHandle, + MouseButton, }; pub struct Window; @@ -23,6 +25,22 @@ impl Window { window_ids.into_iter().map(WindowHandle) } + + pub fn begin_move(&self, button: MouseButton) { + let msg = Msg::WindowMoveGrab { + button: button as u32, + }; + + send_msg(msg).unwrap(); + } + + pub fn begin_resize(&self, button: MouseButton) { + let msg = Msg::WindowResizeGrab { + button: button as u32, + }; + + send_msg(msg).unwrap(); + } } pub struct WindowHandle(WindowId); @@ -88,4 +106,22 @@ impl WindowHandle { fullscreen_or_maximized, } } + + pub fn toggle_tag(&self, tag: &TagHandle) { + let msg = Msg::ToggleTagOnWindow { + window_id: self.0, + tag_id: tag.0, + }; + + send_msg(msg).unwrap(); + } + + pub fn move_to_tag(&self, tag: &TagHandle) { + let msg = Msg::MoveWindowToTag { + window_id: self.0, + tag_id: tag.0, + }; + + send_msg(msg).unwrap(); + } }