tony / oxwm

Branch: c755274
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
47 lines · 1.3 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 _smartgaps_enabled: bool,
25 ) -> Vec<WindowGeometry> {
26 const DEFAULT_WIDTH_RATIO: f32 = 0.6;
27 const DEFAULT_HEIGHT_RATIO: f32 = 0.6;
28
29 windows
30 .iter()
31 .map(|_| {
32 let width = ((screen_width as f32) * DEFAULT_WIDTH_RATIO) as u32;
33 let height = ((screen_height as f32) * DEFAULT_HEIGHT_RATIO) as u32;
34
35 let x = ((screen_width - width) / 2) as i32;
36 let y = ((screen_height - height) / 2) as i32;
37
38 WindowGeometry {
39 x_coordinate: x,
40 y_coordinate: y,
41 width,
42 height,
43 }
44 })
45 .collect()
46 }
47 }