summaryrefslogtreecommitdiff
path: root/src/clients/client.rs
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-06 14:39:55 +0100
committertcmal <me@aria.rip>2024-08-13 17:07:19 +0100
commit89b5f3f87c8022f2d32c422c3516fca2f1538d69 (patch)
tree231457b673cafbfdaea32a8f6a9d8c0aba08a7d3 /src/clients/client.rs
parent5359062bf58a5ff57dfa48492db57f9340ecfbee (diff)
Add tags/workspaces
Diffstat (limited to 'src/clients/client.rs')
-rw-r--r--src/clients/client.rs19
1 files changed, 16 insertions, 3 deletions
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 {