summaryrefslogtreecommitdiff
path: root/src/clients/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/clients/mod.rs')
-rw-r--r--src/clients/mod.rs23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/clients/mod.rs b/src/clients/mod.rs
index 8efa5b1..c370e04 100644
--- a/src/clients/mod.rs
+++ b/src/clients/mod.rs
@@ -210,7 +210,9 @@ impl ClientState {
BORDER_WIDTH,
);
c.set_border(conn, conn.colours.border_normal());
- c.set_floating(conn, floating);
+ if floating {
+ c.set_floating(conn);
+ }
c.update_window_type(conn);
c.ensure_mapped(conn);
@@ -327,7 +329,24 @@ impl ClientState {
/// Toggle whether the client with the given position is floating
pub fn toggle_floating(&mut self, conn: &Connection<'_>, (mon, pos): (usize, usize)) {
let c = &mut self.mons[mon].clients[pos];
- c.set_floating(conn, !c.floating());
+ if c.tiled() {
+ c.set_floating(conn);
+ } else {
+ c.set_tiled();
+ }
+
+ self.rearrange_monitor(conn, mon);
+ }
+
+ /// Toggle whether the client with the given position is fullscreen
+ pub fn toggle_fullscreen(&mut self, conn: &Connection<'_>, (mon, pos): (usize, usize)) {
+ let mon_info = &mut self.mons[mon];
+ let c = &mut mon_info.clients[pos];
+ if c.tiled() {
+ c.set_fullscreen(conn, &mon_info.screen_info);
+ } else {
+ c.set_tiled();
+ }
self.rearrange_monitor(conn, mon);
}