tony / oxwm

Branch: ff0f23e
Switch branches/tags
master
tonybtw Added size hints for old terminals, and added smartgaps flag to lua config for single window gaps 23d144c 2025-12-01
44 lines · 1.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 _smartgaps_enabled: bool,
24 ) -> Vec<WindowGeometry> {
25 let window_count = windows.len();
26 if window_count == 0 {
27 return Vec::new();
28 }
29
30 let x = gaps.outer_horizontal as i32;
31 let y = gaps.outer_vertical as i32;
32 let width = screen_width.saturating_sub(2 * gaps.outer_horizontal);
33 let height = screen_height.saturating_sub(2 * gaps.outer_vertical);
34
35 let geometry = WindowGeometry {
36 x_coordinate: x,
37 y_coordinate: y,
38 width,
39 height,
40 };
41
42 vec![geometry; window_count]
43 }
44 }