tony / oxwm

Branch: 9c5b24f
Switch branches/tags
master
tonybtw Initial commit. 9c5b24f 2025-09-19
26 lines · 796 B Raw Blame History
1 use anyhow::Result;
2 use x11rb::connection::Connection;
3 use x11rb::protocol::xproto::*;
4 use x11rb::rust_connection::RustConnection;
5
6 fn main() -> Result<()> {
7 let (conn, screen_num) = x11rb::connect(None)?;
8 let root = conn.setup().roots[screen_num].root;
9
10 // Ask to manage the root window (like dwm does)
11 conn.change_window_attributes(
12 root,
13 &ChangeWindowAttributesAux::new().event_mask(
14 EventMask::SUBSTRUCTURE_REDIRECT
15 | EventMask::SUBSTRUCTURE_NOTIFY
16 | EventMask::PROPERTY_CHANGE,
17 ),
18 )?.check()?; // will error if another WM is already running
19
20 println!("oxwm started on display {}", screen_num);
21
22 loop {
23 let event = conn.wait_for_event()?;
24 println!("event: {:?}", event);
25 }
26 }