From 89b5f3f87c8022f2d32c422c3516fca2f1538d69 Mon Sep 17 00:00:00 2001 From: tcmal Date: Tue, 6 Aug 2024 14:39:55 +0100 Subject: Add tags/workspaces --- src/clients/client.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/clients/client.rs') diff --git a/src/clients/client.rs b/src/clients/client.rs index 6ab664b..c8fca6c 100644 --- a/src/clients/client.rs +++ b/src/clients/client.rs @@ -2,14 +2,14 @@ use xcb::{ x::{ self, ChangeProperty, ChangeWindowAttributes, ConfigWindow, ConfigWindowMask, ConfigureNotifyEvent, ConfigureWindow, Cw, EventMask, MapWindow, PropMode, SendEvent, - SendEventDest, StackMode, Window, + SendEventDest, StackMode, UnmapWindow, Window, }, VoidCookieChecked, Xid, }; use crate::{config::BORDER_WIDTH, conn_info::Connection}; -use super::{hints, MonitorGeometry}; +use super::{hints, MonitorGeometry, Tag}; /// Information about a single client / window #[derive(Debug)] @@ -28,6 +28,8 @@ pub struct Client { urgent: bool, never_focus: bool, layout_mode: LayoutMode, + + pub tag: Tag, } /// How this window's geometry is determined, @@ -44,7 +46,7 @@ pub enum LayoutMode { } impl Client { - pub const fn new(window: Window) -> Self { + pub const fn new(window: Window, tag: Tag) -> Self { Self { window, x: 0, @@ -56,6 +58,7 @@ impl Client { urgent: false, never_focus: false, layout_mode: LayoutMode::Tiled, + tag, } } @@ -226,6 +229,16 @@ impl Client { }); } + /// Ensure this client is currently unmapped + pub fn ensure_unmapped(&mut self, conn: &Connection<'_>) { + if self.mapped { + conn.send_request(&UnmapWindow { + window: self.window, + }); + self.mapped = false; + } + } + /// Ensure this client is currently mapped / visible pub fn ensure_mapped(&mut self, conn: &Connection<'_>) { if !self.mapped { -- cgit v1.2.3