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
46 lines · 1.2 KB Raw Blame History
1 use super::{GapConfig, Layout, WindowGeometry};
2 use x11rb::protocol::xproto::Window;
3
4 pub struct NormieLayout;
5
6 // This layout should return a no-op similar to DWM.C's "null" mode.
7 impl Layout for NormieLayout {
8 fn name(&self) -> &'static str {
9 super::LayoutType::Normie.as_str()
10 }
11
12 fn symbol(&self) -> &'static str {
13 "><>"
14 }
15
16 fn arrange(
17 &self,
18 windows: &[Window],
19 screen_width: u32,
20 screen_height: u32,
21 _gaps: &GapConfig,
22 _master_factor: f32,
23 _num_master: i32,
24 ) -> Vec<WindowGeometry> {
25 const DEFAULT_WIDTH_RATIO: f32 = 0.6;
26 const DEFAULT_HEIGHT_RATIO: f32 = 0.6;
27
28 windows
29 .iter()
30 .map(|_| {
31 let width = ((screen_width as f32) * DEFAULT_WIDTH_RATIO) as u32;
32 let height = ((screen_height as f32) * DEFAULT_HEIGHT_RATIO) as u32;
33
34 let x = ((screen_width - width) / 2) as i32;
35 let y = ((screen_height - height) / 2) as i32;
36
37 WindowGeometry {
38 x_coordinate: x,
39 y_coordinate: y,
40 width,
41 height,
42 }
43 })
44 .collect()
45 }
46 }