summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxVerevkin <maxxverrr@gmail.com>2023-02-03 11:11:43 +0200
committerMaxVerevkin <maxxverrr@gmail.com>2023-02-03 11:22:34 +0200
commitd8c1050b29a5045f3c963948b3cb832938058042 (patch)
tree86d3900c6540d9032d7bc0f4e0712435e1e5ea9d
parent64a85a42eb50866f47aa12107362fbd37f45c6d6 (diff)
downloadi3bar-mango-d8c1050b29a5045f3c963948b3cb832938058042.tar.gz
implement margins for all directions
-rw-r--r--README.md5
-rw-r--r--src/config.rs10
-rw-r--r--src/state.rs18
3 files changed, 27 insertions, 6 deletions
diff --git a/README.md b/README.md
index 46992bd..7560e49 100644
--- a/README.md
+++ b/README.md
@@ -55,7 +55,10 @@ tag_inactive_fg = "#d79921"
tag_inactive_bg = "#282828"
font = "JetBrainsMono Nerd Font 10"
height = 20
-vertical_margin = 0
+margin_top = 0
+margin_bottom = 0
+margin_left = 0
+margin_right = 0
separator_width = 0
tags_r = 6
tags_padding = 25
diff --git a/src/config.rs b/src/config.rs
index 88e94c8..33cb4f7 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -26,7 +26,10 @@ pub struct Config {
// font and size
pub font: Font,
pub height: u32,
- pub vertical_margin: u32,
+ pub margin_top: i32,
+ pub margin_bottom: i32,
+ pub margin_left: i32,
+ pub margin_right: i32,
pub separator_width: f64,
pub tags_r: f64,
pub tags_padding: f64,
@@ -58,7 +61,10 @@ impl Default for Config {
tag_inactive_bg: Color::from_rgba_hex(0x282828ff),
font: Font::new("monospace 10"),
height: 24,
- vertical_margin: 0,
+ margin_top: 0,
+ margin_bottom: 0,
+ margin_left: 0,
+ margin_right: 0,
separator_width: 2.0,
tags_r: 0.0,
tags_padding: 25.0,
diff --git a/src/state.rs b/src/state.rs
index 5f4d8b9..5884580 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -163,11 +163,23 @@ impl State {
wayrs_client::cstr!("i3bar-river").into(),
layer_surface_cb,
);
- layer_surface.set_size(conn, 0, self.shared_state.config.height);
- layer_surface.set_anchor(conn, self.shared_state.config.position.into());
+
+ let config = &self.shared_state.config;
+
+ layer_surface.set_size(conn, 0, config.height);
+ layer_surface.set_anchor(conn, config.position.into());
+ layer_surface.set_margin(
+ conn,
+ config.margin_top,
+ config.margin_right,
+ config.margin_bottom,
+ config.margin_left,
+ );
layer_surface.set_exclusive_zone(
conn,
- (self.shared_state.config.height + self.shared_state.config.vertical_margin) as i32,
+ (self.shared_state.config.height) as i32
+ + self.shared_state.config.margin_top
+ + self.shared_state.config.margin_bottom,
);
// Note: layer_surface is commited when we receive the scale factor of this output