tony / oxwm

Branch: 16b90b9
Switch branches/tags
master
tonybtw Added smartgaps, mfact, and nmaster (inc master, dec master) functionality from dwm. Default to attach-aside patch. 16b90b9 2025-12-01
43 lines · 1 KB Raw Blame History
1 use super::{GapConfig, Layout, WindowGeometry};
2 use x11rb::protocol::xproto::Window;
3
4 pub struct MonocleLayout;
5
6 impl Layout for MonocleLayout {
7 fn name(&self) -> &'static str {
8 super::LayoutType::Monocle.as_str()
9 }
10
11 fn symbol(&self) -> &'static str {
12 "[M]"
13 }
14
15 fn arrange(
16 &self,
17 windows: &[Window],
18 screen_width: u32,
19 screen_height: u32,
20 gaps: &GapConfig,
21 _master_factor: f32,
22 _num_master: i32,
23 ) -> Vec<WindowGeometry> {
24 let window_count = windows.len();
25 if window_count == 0 {
26 return Vec::new();
27 }
28
29 let x = gaps.outer_horizontal as i32;
30 let y = gaps.outer_vertical as i32;
31 let width = screen_width.saturating_sub(2 * gaps.outer_horizontal);
32 let height = screen_height.saturating_sub(2 * gaps.outer_vertical);
33
34 let geometry = WindowGeometry {
35 x_coordinate: x,
36 y_coordinate: y,
37 width,
38 height,
39 };
40
41 vec![geometry; window_count]
42 }
43 }