forge
Explore
Log in

Don't you dare go Hollow

tab indicator: Add gaps-between-tabs

Browse files at this commit

0dd8e883b092d4bcd735bec45c8cff3d86a4f991Ivan MolodetskikhParent: c31b58e
niri-config/src/lib.rsmodified+3 -0
@@ -695,6 +695,8 @@ pub struct TabIndicator {
695695 pub length: TabIndicatorLength,
696696 #[knuffel(child, unwrap(argument), default = Self::default().position)]
697697 pub position: TabIndicatorPosition,
698+ #[knuffel(child, unwrap(argument), default = Self::default().gaps_between_tabs)]
699+ pub gaps_between_tabs: FloatOrInt<0, 65535>,
698700 #[knuffel(child)]
699701 pub active_color: Option<Color>,
700702 #[knuffel(child)]
@@ -717,6 +719,7 @@ impl Default for TabIndicator {
717719 total_proportion: Some(0.5),
718720 },
719721 position: TabIndicatorPosition::Left,
722+ gaps_between_tabs: FloatOrInt(0.),
720723 active_color: None,
721724 inactive_color: None,
722725 active_gradient: None,
src/layout/tab_indicator.rsmodified+6 -5
@@ -78,6 +78,7 @@ impl TabIndicator {
7878
7979 let width = round(self.config.width.0);
8080 let gap = round(self.config.gap.0);
81+ let gaps_between = round(self.config.gaps_between_tabs.0);
8182
8283 let side = match self.config.position {
8384 TabIndicatorPosition::Left | TabIndicatorPosition::Right => tile_size.h,
@@ -90,11 +91,11 @@ impl TabIndicator {
9091 self.shader_locs.resize_with(count, Default::default);
9192
9293 let pixel = 1. / scale;
93- let shortest_length = count as f64 * pixel;
94+ let shortest_length = count as f64 * (pixel + gaps_between) - gaps_between;
9495 let length = f64::max(min_length, shortest_length);
95- let px_per_tab = length / count as f64;
96+ let px_per_tab = (length + gaps_between) / count as f64 - gaps_between;
9697 let px_per_tab = floor_logical_in_physical_max1(scale, px_per_tab);
97- let floored_length = count as f64 * px_per_tab;
98+ let floored_length = count as f64 * (px_per_tab + gaps_between) - gaps_between;
9899 let mut ones_left = ((length - floored_length) / pixel).max(0.).round() as usize;
99100
100101 let mut shader_loc = Point::from((-gap - width, round((side - length) / 2.)));
@@ -119,10 +120,10 @@ impl TabIndicator {
119120
120121 match self.config.position {
121122 TabIndicatorPosition::Left | TabIndicatorPosition::Right => {
122- shader_loc.y += px_per_tab
123+ shader_loc.y += px_per_tab + gaps_between
123124 }
124125 TabIndicatorPosition::Top | TabIndicatorPosition::Bottom => {
125- shader_loc.x += px_per_tab
126+ shader_loc.x += px_per_tab + gaps_between
126127 }
127128 }
128129
wiki/Configuration:-Layout.mdmodified+3 -0
@@ -62,6 +62,7 @@ layout {
6262 width 4
6363 length total-proportion=1.0
6464 position "right"
65+ gaps-between-tabs 2
6566 active-color "red"
6667 inactive-color "gray"
6768 // 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
436437 `position` sets the position of the tab indicator relative to the window.
437438 It can be `left`, `right`, `top`, or `bottom`.
438439
440+`gaps-between-tabs` controls the gap between individual tabs.
441+
439442 `active-color`, `inactive-color`, `active-gradient`, `inactive-gradient` let you override the colors for the tabs.
440443 They have the same semantics as the border and focus ring colors and gradients.
441444