From 364d621b72874ccccd0c76207c24e83a8e083a32 Mon Sep 17 00:00:00 2001 From: Janis Date: Sun, 8 May 2022 02:53:10 +0200 Subject: [PATCH] added set_tiled function to change window from floating to tiled --- src/clients.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/clients.rs b/src/clients.rs index f581489..567e350 100644 --- a/src/clients.rs +++ b/src/clients.rs @@ -537,6 +537,23 @@ impl ClientState { } } + /** + Sets a floating client to tiled and returns true, does nothing for a tiled client and + returns false. If this function returns `true` you have to call `arrange_clients` after. + */ + pub fn set_tiled(&mut self, key: &K) -> bool + where + K: ClientKey, + { + if self.get(key).is_floating() { + self.toggle_floating(key); + + true + } else { + false + } + } + /** This function invalidates the tiling, call `arrange_clients` to fix it again (it doesn't do it automatically since xlib has to move and resize all windows anyways).