tony / oxwm

Branch: 6faa550
Switch branches/tags
master
tonybtw Added tabbed mode, fixed bug where nixos read only directory caused crash every launch, added sane default comments for default config file. 333cb2d 2025-11-23
45 lines · 1.1 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 ) -> 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 + TAB_BAR_HEIGHT) as i32;
31 let width = screen_width.saturating_sub(2 * gaps.outer_horizontal);
32 let height = screen_height
33 .saturating_sub(2 * gaps.outer_vertical)
34 .saturating_sub(TAB_BAR_HEIGHT);
35
36 let geometry = WindowGeometry {
37 x_coordinate: x,
38 y_coordinate: y,
39 width,
40 height,
41 };
42
43 vec![geometry; window_count]
44 }
45 }