oxwm

https://git.tonybtw.com/oxwm.git git://git.tonybtw.com/oxwm.git
1,215 bytes raw
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
        _smartgaps_enabled: bool,
26
    ) -> Vec<WindowGeometry> {
27
        let window_count = windows.len();
28
        if window_count == 0 {
29
            return Vec::new();
30
        }
31
32
        let x = gaps.outer_horizontal as i32;
33
        let y = (gaps.outer_vertical + TAB_BAR_HEIGHT) as i32;
34
        let width = screen_width.saturating_sub(2 * gaps.outer_horizontal);
35
        let height = screen_height
36
            .saturating_sub(2 * gaps.outer_vertical)
37
            .saturating_sub(TAB_BAR_HEIGHT);
38
39
        let geometry = WindowGeometry {
40
            x_coordinate: x,
41
            y_coordinate: y,
42
            width,
43
            height,
44
        };
45
46
        vec![geometry; window_count]
47
    }
48
}