Diff
diff --git a/src/config.rs b/src/config.rs
index cef7770..6c2a317 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -15,6 +15,7 @@ pub const FONT: &str = "JetBrainsMono Nerd Font:style=Bold:size=14";
// DEFAULTS
// ========================================
pub const TERMINAL: &str = "alacritty";
+pub const XCLOCK: &str = "xclock";
pub const MODKEY: KeyButMask = KeyButMask::MOD1;
// ========================================
@@ -79,6 +80,7 @@ pub const TAGS: [&str; TAG_COUNT] = ["1", "2", "3", "4", "5", "6", "7", "8", "9"
#[rustfmt::skip]
pub const KEYBINDINGS: &[Key] = &[
Key::new(&[MODKEY], keycodes::RETURN, KeyAction::Spawn, Arg::Str(TERMINAL)),
+ Key::new(&[MODKEY], keycodes::F, KeyAction::Spawn, Arg::Str(XCLOCK)),
Key::new(&[MODKEY], keycodes::S, KeyAction::Spawn, Arg::Array(SCREENSHOT_CMD)),
Key::new(&[MODKEY], keycodes::D, KeyAction::Spawn, Arg::Array(DMENU_CMD)),
diff --git a/src/window_manager.rs b/src/window_manager.rs
index 329ba42..b6216e6 100644
--- a/src/window_manager.rs
+++ b/src/window_manager.rs
@@ -97,13 +97,36 @@ impl WindowManager {
continue;
}
- if attrs.map_state == MapState::VIEWABLE || attrs.map_state == MapState::UNMAPPED {
+ if attrs.map_state == MapState::VIEWABLE {
println!(
- " -> Managing window, tagging with {:b}",
+ " -> Managing VIEWABLE window, tagging with {:b}",
self.selected_tags
);
self.windows.push(window);
self.window_tags.insert(window, self.selected_tags);
+ continue;
+ }
+
+ if attrs.map_state == MapState::UNMAPPED {
+ let has_wm_class = match self
+ .connection
+ .get_property(false, window, AtomEnum::WM_CLASS, AtomEnum::STRING, 0, 1024)?
+ .reply()
+ {
+ Ok(prop) => !prop.value.is_empty(),
+ Err(_) => false,
+ };
+
+ if has_wm_class {
+ println!(
+ " -> Managing UNMAPPED window (has WM_CLASS), tagging with {:b}",
+ self.selected_tags
+ );
+ self.windows.push(window);
+ self.window_tags.insert(window, self.selected_tags);
+ } else {
+ println!(" -> Skipped UNMAPPED (no WM_CLASS)");
+ }
} else {
println!(" -> Skipped (map_state={:?})", attrs.map_state);
}
@@ -371,6 +394,7 @@ impl WindowManager {
}
Ok(None)
}
+
fn apply_layout(&self) -> Result<()> {
let screen_width = self.screen.width_in_pixels as u32;
let screen_height = self.screen.height_in_pixels as u32;