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