oxwm

https://git.tonybtw.com/oxwm.git git://git.tonybtw.com/oxwm.git

literally 9 lines and got mouse hover support. daily driving time.

Commit
e84fe9f6e3c530ec76d4c6aaa89f67134d43e429
Parent
af38201
Author
tonybtw <tonybtw@tonybtw.com>
Date
2025-10-05 23:45:33

Diff

diff --git a/src/window_manager.rs b/src/window_manager.rs
index 5e45808..9fef61a 100644
--- a/src/window_manager.rs
+++ b/src/window_manager.rs
@@ -449,6 +449,11 @@ impl WindowManager {
         match event {
             Event::MapRequest(event) => {
                 self.connection.map_window(event.window)?;
+                self.connection.change_window_attributes(
+                    event.window,
+                    &ChangeWindowAttributesAux::new().event_mask(EventMask::ENTER_WINDOW),
+                )?;
+
                 self.windows.push(event.window);
                 self.window_tags.insert(event.window, self.selected_tags);
 
@@ -468,6 +473,14 @@ impl WindowManager {
                     self.remove_window(event.window)?;
                 }
             }
+            Event::EnterNotify(event) => {
+                if event.mode != x11rb::protocol::xproto::NotifyMode::NORMAL {
+                    return Ok(None);
+                }
+                if self.windows.contains(&event.event) {
+                    self.set_focus(Some(event.event))?;
+                }
+            }
             Event::KeyPress(event) => {
                 let (action, arg) = keyboard::handle_key_press(event)?;