Skip to content

Commit 19f68f8

Browse files
committed
added window_margin option to set a margin between windows
1 parent c98a06e commit 19f68f8

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

CONFIGURATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Window settings.
3131
- **`text_color`** (string): Text color of the window title bars in hex format (e.g., `"#ffffff"`).
3232
- **`background_color`** (string): Background color of the window title bars in hex format (e.g., `"#272727"`).
3333
- **`reverse_resize`** (boolean): Reverse the direction of window resizing (default: `false`).
34+
- **`window_margin`** (integer): Margin around windows in pixels (default: `0`).
3435
```toml
3536
[window]
3637
scale_steps = 20

gridwm.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ scale_steps = 20
99
window_bars = true
1010
window_bar_height = 20
1111
reverse_resize = true
12+
window_margin = 14
1213

1314
[keyboard]
1415
layout = "de"

src/gridwm/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub struct Window {
2727
pub text_color: String,
2828
pub background_color: String,
2929
pub reverse_resize: bool,
30+
pub window_margin: i32,
3031
}
3132

3233
impl Default for Window {
@@ -38,6 +39,7 @@ impl Default for Window {
3839
text_color: "#ffffff".into(),
3940
background_color: "#272727".into(),
4041
reverse_resize: false,
42+
window_margin: 0,
4143
}
4244
}
4345
}

src/gridwm/mod.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,10 +1127,13 @@ impl GridWM {
11271127
};
11281128

11291129
WindowInfo {
1130-
x: (i % cols) * w,
1131-
y: ((i / cols) * h) + bar_height + window_bar_height,
1132-
w,
1133-
h: h - window_bar_height,
1130+
x: (i % cols) * w + (self.config.window.window_margin / 2),
1131+
y: ((i / cols) * h)
1132+
+ bar_height
1133+
+ window_bar_height
1134+
+ (self.config.window.window_margin / 2),
1135+
w: w - self.config.window.window_margin,
1136+
h: h - window_bar_height - self.config.window.window_margin,
11341137
}
11351138
})
11361139
.collect()

0 commit comments

Comments
 (0)