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
47 lines · 1.2 KB Raw Blame History
1 use super::{GapConfig, Layout, WindowGeometry};
2 use x11rb::protocol::xproto::Window;
3
4 pub struct TabbedLayout;
5
6 pub const TAB_BAR_HEIGHT: u32 = 28;
7
8 impl Layout for TabbedLayout {
9 fn name(&self) -> &'static str {
10 super::LayoutType::Tabbed.as_str()
11 }
12
13 fn symbol(&self) -> &'static str {
14 "[=]"
15 }
16
17 fn arrange(
18 &self,
19 windows: &[Window],
20 screen_width: u32,
21 screen_height: u32,
22 gaps: &GapConfig,
23 _master_factor: f32,
24 _num_master: i32,
25 ) -> Vec<WindowGeometry> {
26 let window_count = windows.len();
27 if window_count == 0 {
28 return Vec::new();
29 }
30
31 let x = gaps.outer_horizontal as i32;
32 let y = (gaps.outer_vertical + TAB_BAR_HEIGHT) as i32;
33 let width = screen_width.saturating_sub(2 * gaps.outer_horizontal);
34 let height = screen_height
35 .saturating_sub(2 * gaps.outer_vertical)
36 .saturating_sub(TAB_BAR_HEIGHT);
37
38 let geometry = WindowGeometry {
39 x_coordinate: x,
40 y_coordinate: y,
41 width,
42 height,
43 };
44
45 vec![geometry; window_count]
46 }
47 }