aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--niri-config/src/lib.rs3
-rw-r--r--src/layout/tab_indicator.rs11
-rw-r--r--wiki/Configuration:-Layout.md3
3 files changed, 12 insertions, 5 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs
index 4b1da5bc..880a08e9 100644
--- a/niri-config/src/lib.rs
+++ b/niri-config/src/lib.rs
@@ -695,6 +695,8 @@ pub struct TabIndicator {
pub length: TabIndicatorLength,
#[knuffel(child, unwrap(argument), default = Self::default().position)]
pub position: TabIndicatorPosition,
+ #[knuffel(child, unwrap(argument), default = Self::default().gaps_between_tabs)]
+ pub gaps_between_tabs: FloatOrInt<0, 65535>,
#[knuffel(child)]
pub active_color: Option<Color>,
#[knuffel(child)]
@@ -717,6 +719,7 @@ impl Default for TabIndicator {
total_proportion: Some(0.5),
},
position: TabIndicatorPosition::Left,
+ gaps_between_tabs: FloatOrInt(0.),
active_color: None,
inactive_color: None,
active_gradient: None,
diff --git a/src/layout/tab_indicator.rs b/src/layout/tab_indicator.rs
index 72652369..84e65dfc 100644
--- a/src/layout/tab_indicator.rs
+++ b/src/layout/tab_indicator.rs
@@ -78,6 +78,7 @@ impl TabIndicator {
let width = round(self.config.width.0);
let gap = round(self.config.gap.0);
+ let gaps_between = round(self.config.gaps_between_tabs.0);
let side = match self.config.position {
TabIndicatorPosition::Left | TabIndicatorPosition::Right => tile_size.h,
@@ -90,11 +91,11 @@ impl TabIndicator {
self.shader_locs.resize_with(count, Default::default);
let pixel = 1. / scale;
- let shortest_length = count as f64 * pixel;
+ let shortest_length = count as f64 * (pixel + gaps_between) - gaps_between;
let length = f64::max(min_length, shortest_length);
- let px_per_tab = length / count as f64;
+ let px_per_tab = (length + gaps_between) / count as f64 - gaps_between;
let px_per_tab = floor_logical_in_physical_max1(scale, px_per_tab);
- let floored_length = count as f64 * px_per_tab;
+ let floored_length = count as f64 * (px_per_tab + gaps_between) - gaps_between;
let mut ones_left = ((length - floored_length) / pixel).max(0.).round() as usize;
let mut shader_loc = Point::from((-gap - width, round((side - length) / 2.)));
@@ -119,10 +120,10 @@ impl TabIndicator {
match self.config.position {
TabIndicatorPosition::Left | TabIndicatorPosition::Right => {
- shader_loc.y += px_per_tab
+ shader_loc.y += px_per_tab + gaps_between
}
TabIndicatorPosition::Top | TabIndicatorPosition::Bottom => {
- shader_loc.x += px_per_tab
+ shader_loc.x += px_per_tab + gaps_between
}
}
diff --git a/wiki/Configuration:-Layout.md b/wiki/Configuration:-Layout.md
index 91a5255a..713f6f37 100644
--- a/wiki/Configuration:-Layout.md
+++ b/wiki/Configuration:-Layout.md
@@ -62,6 +62,7 @@ layout {
width 4
length total-proportion=1.0
position "right"
+ gaps-between-tabs 2
active-color "red"
inactive-color "gray"
// active-gradient from="#80c8ff" to="#bbddff" angle=45
@@ -436,6 +437,8 @@ By default, the tab indicator has length equal to half of the window size, or `l
`position` sets the position of the tab indicator relative to the window.
It can be `left`, `right`, `top`, or `bottom`.
+`gaps-between-tabs` controls the gap between individual tabs.
+
`active-color`, `inactive-color`, `active-gradient`, `inactive-gradient` let you override the colors for the tabs.
They have the same semantics as the border and focus ring colors and gradients.