forge
Explore
Log in

Don't you dare go Hollow

Implement tab indicators

Browse files at this commit

a451f75917e427a4b4c7d986ce74e5a3999e563dIvan MolodetskikhParent: 1515410
niri-config/src/lib.rsmodified+93 -0
@@ -445,6 +445,8 @@ pub struct Layout {
445445 #[knuffel(child, default)]
446446 pub shadow: Shadow,
447447 #[knuffel(child, default)]
448+ pub tab_indicator: TabIndicator,
449+ #[knuffel(child, default)]
448450 pub insert_hint: InsertHint,
449451 #[knuffel(child, unwrap(children), default)]
450452 pub preset_column_widths: Vec<PresetSize>,
@@ -472,6 +474,7 @@ impl Default for Layout {
472474 focus_ring: Default::default(),
473475 border: Default::default(),
474476 shadow: Default::default(),
477+ tab_indicator: Default::default(),
475478 insert_hint: Default::default(),
476479 preset_column_widths: Default::default(),
477480 default_column_width: Default::default(),
@@ -676,6 +679,49 @@ pub struct ShadowOffset {
676679 pub y: FloatOrInt<-65535, 65535>,
677680 }
678681
682+#[derive(knuffel::Decode, Debug, Clone, Copy, PartialEq)]
683+pub struct TabIndicator {
684+ #[knuffel(child)]
685+ pub off: bool,
686+ #[knuffel(child, unwrap(argument), default = Self::default().gap)]
687+ pub gap: FloatOrInt<-65535, 65535>,
688+ #[knuffel(child, unwrap(argument), default = Self::default().width)]
689+ pub width: FloatOrInt<0, 65535>,
690+ #[knuffel(child, default = Self::default().length)]
691+ pub length: TabIndicatorLength,
692+ #[knuffel(child)]
693+ pub active_color: Option<Color>,
694+ #[knuffel(child)]
695+ pub inactive_color: Option<Color>,
696+ #[knuffel(child)]
697+ pub active_gradient: Option<Gradient>,
698+ #[knuffel(child)]
699+ pub inactive_gradient: Option<Gradient>,
700+}
701+
702+impl Default for TabIndicator {
703+ fn default() -> Self {
704+ Self {
705+ off: false,
706+ gap: FloatOrInt(5.),
707+ width: FloatOrInt(4.),
708+ length: TabIndicatorLength {
709+ total_proportion: Some(0.5),
710+ },
711+ active_color: None,
712+ inactive_color: None,
713+ active_gradient: None,
714+ inactive_gradient: None,
715+ }
716+ }
717+}
718+
719+#[derive(knuffel::Decode, Debug, Clone, Copy, PartialEq)]
720+pub struct TabIndicatorLength {
721+ #[knuffel(property)]
722+ pub total_proportion: Option<f64>,
723+}
724+
679725 #[derive(knuffel::Decode, Debug, Clone, Copy, PartialEq)]
680726 pub struct InsertHint {
681727 #[knuffel(child)]
@@ -1101,6 +1147,8 @@ pub struct WindowRule {
11011147 pub border: BorderRule,
11021148 #[knuffel(child, default)]
11031149 pub shadow: ShadowRule,
1150+ #[knuffel(child, default)]
1151+ pub tab_indicator: TabIndicatorRule,
11041152 #[knuffel(child, unwrap(argument))]
11051153 pub draw_border_with_background: Option<bool>,
11061154 #[knuffel(child, unwrap(argument))]
@@ -1202,6 +1250,18 @@ pub struct ShadowRule {
12021250 pub inactive_color: Option<Color>,
12031251 }
12041252
1253+#[derive(knuffel::Decode, Debug, Default, Clone, Copy, PartialEq)]
1254+pub struct TabIndicatorRule {
1255+ #[knuffel(child)]
1256+ pub active_color: Option<Color>,
1257+ #[knuffel(child)]
1258+ pub inactive_color: Option<Color>,
1259+ #[knuffel(child)]
1260+ pub active_gradient: Option<Gradient>,
1261+ #[knuffel(child)]
1262+ pub inactive_gradient: Option<Gradient>,
1263+}
1264+
12051265 #[derive(knuffel::Decode, Debug, Clone, Copy, PartialEq)]
12061266 pub struct FloatingPosition {
12071267 #[knuffel(property)]
@@ -2039,6 +2099,23 @@ impl ShadowRule {
20392099 }
20402100 }
20412101
2102+impl TabIndicatorRule {
2103+ pub fn merge_with(&mut self, other: &Self) {
2104+ if let Some(x) = other.active_color {
2105+ self.active_color = Some(x);
2106+ }
2107+ if let Some(x) = other.inactive_color {
2108+ self.inactive_color = Some(x);
2109+ }
2110+ if let Some(x) = other.active_gradient {
2111+ self.active_gradient = Some(x);
2112+ }
2113+ if let Some(x) = other.inactive_gradient {
2114+ self.inactive_gradient = Some(x);
2115+ }
2116+ }
2117+}
2118+
20422119 impl CornerRadius {
20432120 pub fn fit_to(self, width: f32, height: f32) -> Self {
20442121 // Like in CSS: https://drafts.csswg.org/css-backgrounds/#corner-overlap
@@ -3473,6 +3550,10 @@ mod tests {
34733550 offset x=10 y=-20
34743551 }
34753552
3553+ tab-indicator {
3554+ width 10
3555+ }
3556+
34763557 preset-column-widths {
34773558 proportion 0.25
34783559 proportion 0.5
@@ -3571,6 +3652,10 @@ mod tests {
35713652 on
35723653 width 8.5
35733654 }
3655+
3656+ tab-indicator {
3657+ active-color "#f00"
3658+ }
35743659 }
35753660
35763661 layer-rule {
@@ -3729,6 +3814,10 @@ mod tests {
37293814 },
37303815 ..Default::default()
37313816 },
3817+ tab_indicator: TabIndicator {
3818+ width: FloatOrInt(10.),
3819+ ..Default::default()
3820+ },
37323821 insert_hint: InsertHint {
37333822 off: false,
37343823 color: Color::from_rgba8_unpremul(255, 200, 127, 255),
@@ -3875,6 +3964,10 @@ mod tests {
38753964 width: Some(FloatOrInt(8.5)),
38763965 ..Default::default()
38773966 },
3967+ tab_indicator: TabIndicatorRule {
3968+ active_color: Some(Color::from_rgba8_unpremul(255, 0, 0, 255)),
3969+ ..Default::default()
3970+ },
38783971 ..Default::default()
38793972 }],
38803973 layer_rules: vec![
src/layout/focus_ring.rsmodified+4 -0
@@ -262,4 +262,8 @@ impl FocusRing {
262262 pub fn is_off(&self) -> bool {
263263 self.config.off
264264 }
265+
266+ pub fn config(&self) -> &niri_config::FocusRing {
267+ &self.config
268+ }
265269 }
src/layout/mod.rsmodified+4 -0
@@ -80,6 +80,7 @@ pub mod monitor;
8080 pub mod opening_window;
8181 pub mod scrolling;
8282 pub mod shadow;
83+pub mod tab_indicator;
8384 pub mod tile;
8485 pub mod workspace;
8586
@@ -312,6 +313,7 @@ pub struct Options {
312313 pub focus_ring: niri_config::FocusRing,
313314 pub border: niri_config::Border,
314315 pub shadow: niri_config::Shadow,
316+ pub tab_indicator: niri_config::TabIndicator,
315317 pub insert_hint: niri_config::InsertHint,
316318 pub center_focused_column: CenterFocusedColumn,
317319 pub always_center_single_column: bool,
@@ -337,6 +339,7 @@ impl Default for Options {
337339 focus_ring: Default::default(),
338340 border: Default::default(),
339341 shadow: Default::default(),
342+ tab_indicator: Default::default(),
340343 insert_hint: Default::default(),
341344 center_focused_column: Default::default(),
342345 always_center_single_column: false,
@@ -550,6 +553,7 @@ impl Options {
550553 focus_ring: layout.focus_ring,
551554 border: layout.border,
552555 shadow: layout.shadow,
556+ tab_indicator: layout.tab_indicator,
553557 insert_hint: layout.insert_hint,
554558 center_focused_column: layout.center_focused_column,
555559 always_center_single_column: layout.always_center_single_column,
src/layout/scrolling.rsmodified+67 -10
@@ -11,6 +11,7 @@ use smithay::utils::{Logical, Point, Rectangle, Scale, Serial, Size};
1111
1212 use super::closing_window::{ClosingWindow, ClosingWindowRenderElement};
1313 use super::insert_hint_element::{InsertHintElement, InsertHintRenderElement};
14+use super::tab_indicator::{TabIndicator, TabIndicatorRenderElement, TabInfo};
1415 use super::tile::{Tile, TileRenderElement, TileRenderSnapshot};
1516 use super::workspace::{InteractiveResize, ResolvedSize};
1617 use super::{ConfigureIntent, InteractiveResizeData, LayoutElement, Options, RemovedTile};
@@ -94,6 +95,7 @@ niri_render_elements! {
9495 ScrollingSpaceRenderElement<R> => {
9596 Tile = TileRenderElement<R>,
9697 ClosingWindow = ClosingWindowRenderElement,
98+ TabIndicator = TabIndicatorRenderElement,
9799 InsertHint = InsertHintRenderElement,
98100 }
99101 }
@@ -174,6 +176,9 @@ pub struct Column<W: LayoutElement> {
174176 /// How this column displays and arranges windows.
175177 display_mode: ColumnDisplay,
176178
179+ /// Tab indicator for the tabbed display mode.
180+ tab_indicator: TabIndicator,
181+
177182 /// Animation of the render offset during window swapping.
178183 move_animation: Option<Animation>,
179184
@@ -2527,19 +2532,44 @@ impl<W: LayoutElement> ScrollingSpace<W> {
25272532 }
25282533
25292534 let mut first = true;
2530- for (tile, tile_pos, visible) in self.tiles_with_render_positions() {
2531- // For the active tile (which comes first), draw the focus ring.
2532- let focus_ring = focus_ring && first;
2533- first = false;
25342535
2535- if !visible {
2536- continue;
2536+ // This matches self.tiles_in_render_order().
2537+ let view_off = Point::from((-self.view_pos(), 0.));
2538+ for (col, col_x) in self.columns_in_render_order() {
2539+ let col_off = Point::from((col_x, 0.));
2540+ let col_render_off = col.render_offset();
2541+
2542+ // Draw the tab indicator on top.
2543+ {
2544+ // This is the "static tile position" so to say: it excludes the tile offset (used
2545+ // for e.g. centering smaller tiles in always-center) and the tile render offset
2546+ // (used for tile-specific animations).
2547+ let pos = view_off + col_off + col_render_off + col.tiles_origin();
2548+ let pos = pos.to_physical_precise_round(scale).to_logical(scale);
2549+ rv.extend(col.tab_indicator.render(renderer, pos).map(Into::into));
25372550 }
25382551
2539- rv.extend(
2540- tile.render(renderer, tile_pos, scale, focus_ring, target)
2541- .map(Into::into),
2542- );
2552+ for (tile, tile_off, visible) in col.tiles_in_render_order() {
2553+ let tile_pos =
2554+ view_off + col_off + col_render_off + tile_off + tile.render_offset();
2555+ // Round to physical pixels.
2556+ let tile_pos = tile_pos.to_physical_precise_round(scale).to_logical(scale);
2557+
2558+ // And now the drawing logic.
2559+
2560+ // For the active tile (which comes first), draw the focus ring.
2561+ let focus_ring = focus_ring && first;
2562+ first = false;
2563+
2564+ if !visible {
2565+ continue;
2566+ }
2567+
2568+ rv.extend(
2569+ tile.render(renderer, tile_pos, scale, focus_ring, target)
2570+ .map(Into::into),
2571+ );
2572+ }
25432573 }
25442574
25452575 rv
@@ -3268,6 +3298,7 @@ impl<W: LayoutElement> Column<W> {
32683298 is_full_width,
32693299 is_fullscreen: false,
32703300 display_mode,
3301+ tab_indicator: TabIndicator::new(options.tab_indicator),
32713302 move_animation: None,
32723303 view_size,
32733304 working_area,
@@ -3326,6 +3357,7 @@ impl<W: LayoutElement> Column<W> {
33263357 data.update(tile);
33273358 }
33283359
3360+ self.tab_indicator.update_config(options.tab_indicator);
33293361 self.view_size = view_size;
33303362 self.working_area = working_area;
33313363 self.scale = scale;
@@ -3361,6 +3393,31 @@ impl<W: LayoutElement> Column<W> {
33613393 tile_view_rect.loc -= tile_off + tile.render_offset();
33623394 tile.update_render_elements(is_active, tile_view_rect);
33633395 }
3396+
3397+ let (tile, tile_off) = self.tiles().nth(self.active_tile_idx).unwrap();
3398+ let mut tile_view_rect = view_rect;
3399+ tile_view_rect.loc -= tile_off + tile.render_offset();
3400+
3401+ let config = self.tab_indicator.config();
3402+ let tabs = self.tiles.iter().enumerate().map(|(tile_idx, tile)| {
3403+ let is_active = tile_idx == active_idx;
3404+ TabInfo::from_tile(tile, is_active, &config)
3405+ });
3406+
3407+ // Hide the tab indicator in fullscreen. If you have it configured to overlap the window,
3408+ // you don't want that to happen in fullscreen. Also, laying things out correctly when the
3409+ // tab indicator is within the column and the column goes fullscreen, would require too
3410+ // many changes to the code for too little benefit (it's mostly invisible anyway).
3411+ let enabled = self.display_mode == ColumnDisplay::Tabbed && !self.is_fullscreen;
3412+
3413+ self.tab_indicator.update_render_elements(
3414+ enabled,
3415+ tile.animated_tile_size(),
3416+ tile_view_rect,
3417+ tabs,
3418+ is_active,
3419+ self.scale,
3420+ );
33643421 }
33653422
33663423 pub fn render_offset(&self) -> Point<f64, Logical> {
src/layout/tab_indicator.rsadded+201 -0
@@ -0,0 +1,201 @@
1+use std::iter::zip;
2+
3+use niri_config::{CornerRadius, Gradient, GradientRelativeTo};
4+use smithay::utils::{Logical, Point, Rectangle, Size};
5+
6+use super::tile::Tile;
7+use super::LayoutElement;
8+use crate::niri_render_elements;
9+use crate::render_helpers::border::BorderRenderElement;
10+use crate::render_helpers::renderer::NiriRenderer;
11+use crate::utils::{floor_logical_in_physical_max1, round_logical_in_physical};
12+
13+#[derive(Debug)]
14+pub struct TabIndicator {
15+ shader_locs: Vec<Point<f64, Logical>>,
16+ shaders: Vec<BorderRenderElement>,
17+ config: niri_config::TabIndicator,
18+}
19+
20+#[derive(Debug)]
21+pub struct TabInfo {
22+ pub gradient: Gradient,
23+}
24+
25+niri_render_elements! {
26+ TabIndicatorRenderElement => {
27+ Gradient = BorderRenderElement,
28+ }
29+}
30+
31+impl TabIndicator {
32+ pub fn new(config: niri_config::TabIndicator) -> Self {
33+ Self {
34+ shader_locs: Vec::new(),
35+ shaders: Vec::new(),
36+ config,
37+ }
38+ }
39+
40+ pub fn update_config(&mut self, config: niri_config::TabIndicator) {
41+ self.config = config;
42+ }
43+
44+ pub fn update_shaders(&mut self) {
45+ for elem in &mut self.shaders {
46+ elem.damage_all();
47+ }
48+ }
49+
50+ pub fn update_render_elements(
51+ &mut self,
52+ enabled: bool,
53+ tile_size: Size<f64, Logical>,
54+ tile_view_rect: Rectangle<f64, Logical>,
55+ tabs: impl Iterator<Item = TabInfo> + Clone,
56+ // TODO: do we indicate inactive-but-selected somehow?
57+ _is_active: bool,
58+ scale: f64,
59+ ) {
60+ if !enabled || self.config.off {
61+ self.shader_locs.clear();
62+ self.shaders.clear();
63+ return;
64+ }
65+
66+ // Tab indicators are rendered relative to the tile geometry.
67+ let tile_geo = Rectangle::new(Point::from((0., 0.)), tile_size);
68+
69+ let round = |logical: f64| round_logical_in_physical(scale, logical);
70+
71+ let width = round(self.config.width.0);
72+ let gap = round(self.config.gap.0);
73+
74+ let total_prop = self.config.length.total_proportion.unwrap_or(0.5);
75+ let min_length = round(tile_size.h * total_prop.clamp(0., 2.));
76+
77+ let count = tabs.clone().count();
78+ self.shaders.resize_with(count, Default::default);
79+ self.shader_locs.resize_with(count, Default::default);
80+
81+ let pixel = 1. / scale;
82+ let shortest_length = count as f64 * pixel;
83+ let length = f64::max(min_length, shortest_length);
84+ let px_per_tab = length / count as f64;
85+ let px_per_tab = floor_logical_in_physical_max1(scale, px_per_tab);
86+ let floored_length = count as f64 * px_per_tab;
87+ let mut ones_left = ((length - floored_length) / pixel).max(0.).round() as usize;
88+
89+ let mut shader_loc = Point::from((-gap - width, round((tile_size.h - length) / 2.)));
90+
91+ for ((shader, loc), tab) in zip(&mut self.shaders, &mut self.shader_locs).zip(tabs) {
92+ *loc = shader_loc;
93+
94+ let mut px_per_tab = px_per_tab;
95+ if ones_left > 0 {
96+ ones_left -= 1;
97+ px_per_tab += pixel;
98+ }
99+ shader_loc.y += px_per_tab;
100+
101+ let shader_size = Size::from((width, px_per_tab));
102+
103+ let mut gradient_area = match tab.gradient.relative_to {
104+ GradientRelativeTo::Window => tile_geo,
105+ GradientRelativeTo::WorkspaceView => tile_view_rect,
106+ };
107+ gradient_area.loc -= *loc;
108+
109+ shader.update(
110+ shader_size,
111+ gradient_area,
112+ tab.gradient.in_,
113+ tab.gradient.from,
114+ tab.gradient.to,
115+ ((tab.gradient.angle as f32) - 90.).to_radians(),
116+ Rectangle::from_size(shader_size),
117+ 0.,
118+ CornerRadius::default(),
119+ scale as f32,
120+ 1.,
121+ );
122+ }
123+ }
124+
125+ pub fn render(
126+ &self,
127+ renderer: &mut impl NiriRenderer,
128+ tile_pos: Point<f64, Logical>,
129+ ) -> impl Iterator<Item = TabIndicatorRenderElement> + '_ {
130+ let has_border_shader = BorderRenderElement::has_shader(renderer);
131+ if !has_border_shader {
132+ return None.into_iter().flatten();
133+ }
134+
135+ let rv = zip(&self.shaders, &self.shader_locs)
136+ .map(move |(shader, loc)| shader.clone().with_location(tile_pos + *loc))
137+ .map(TabIndicatorRenderElement::from);
138+
139+ Some(rv).into_iter().flatten()
140+ }
141+
142+ pub fn config(&self) -> niri_config::TabIndicator {
143+ self.config
144+ }
145+}
146+
147+impl TabInfo {
148+ pub fn from_tile<W: LayoutElement>(
149+ tile: &Tile<W>,
150+ is_active: bool,
151+ config: &niri_config::TabIndicator,
152+ ) -> Self {
153+ let rules = tile.window().rules();
154+ let rule = rules.tab_indicator;
155+
156+ let gradient_from_rule = || {
157+ let (color, gradient) = if is_active {
158+ (rule.active_color, rule.active_gradient)
159+ } else {
160+ (rule.inactive_color, rule.inactive_gradient)
161+ };
162+ let color = color.map(Gradient::from);
163+ gradient.or(color)
164+ };
165+
166+ let gradient_from_config = || {
167+ let (color, gradient) = if is_active {
168+ (config.active_color, config.active_gradient)
169+ } else {
170+ (config.inactive_color, config.inactive_gradient)
171+ };
172+ let color = color.map(Gradient::from);
173+ gradient.or(color)
174+ };
175+
176+ let gradient_from_border = || {
177+ // Come up with tab indicator gradient matching the focus ring or the border, whichever
178+ // one is enabled.
179+ let focus_ring_config = tile.focus_ring().config();
180+ let border_config = tile.border().config();
181+ let config = if focus_ring_config.off {
182+ border_config
183+ } else {
184+ focus_ring_config
185+ };
186+
187+ let (color, gradient) = if is_active {
188+ (config.active_color, config.active_gradient)
189+ } else {
190+ (config.inactive_color, config.inactive_gradient)
191+ };
192+ gradient.unwrap_or_else(|| Gradient::from(color))
193+ };
194+
195+ let gradient = gradient_from_rule()
196+ .or_else(gradient_from_config)
197+ .unwrap_or_else(gradient_from_border);
198+
199+ TabInfo { gradient }
200+ }
201+}
src/layout/tests.rsmodified+20 -1
@@ -1,6 +1,6 @@
11 use std::cell::Cell;
22
3-use niri_config::{FloatOrInt, OutputName, WorkspaceName, WorkspaceReference};
3+use niri_config::{FloatOrInt, OutputName, TabIndicatorLength, WorkspaceName, WorkspaceReference};
44 use proptest::prelude::*;
55 use proptest_derive::Arbitrary;
66 use smithay::output::{Mode, PhysicalProperties, Subpixel};
@@ -3239,6 +3239,23 @@ prop_compose! {
32393239 }
32403240 }
32413241
3242+prop_compose! {
3243+ fn arbitrary_tab_indicator()(
3244+ off in any::<bool>(),
3245+ width in arbitrary_spacing(),
3246+ gap in arbitrary_spacing_neg(),
3247+ length in (0f64..2f64),
3248+ ) -> niri_config::TabIndicator {
3249+ niri_config::TabIndicator {
3250+ off,
3251+ width: FloatOrInt(width),
3252+ gap: FloatOrInt(gap),
3253+ length: TabIndicatorLength { total_proportion: Some(length) },
3254+ ..Default::default()
3255+ }
3256+ }
3257+}
3258+
32423259 prop_compose! {
32433260 fn arbitrary_options()(
32443261 gaps in arbitrary_spacing(),
@@ -3246,6 +3263,7 @@ prop_compose! {
32463263 focus_ring in arbitrary_focus_ring(),
32473264 border in arbitrary_border(),
32483265 shadow in arbitrary_shadow(),
3266+ tab_indicator in arbitrary_tab_indicator(),
32493267 center_focused_column in arbitrary_center_focused_column(),
32503268 always_center_single_column in any::<bool>(),
32513269 empty_workspace_above_first in any::<bool>(),
@@ -3259,6 +3277,7 @@ prop_compose! {
32593277 focus_ring,
32603278 border,
32613279 shadow,
3280+ tab_indicator,
32623281 ..Default::default()
32633282 }
32643283 }
src/layout/tile.rsmodified+10 -2
@@ -563,7 +563,7 @@ impl<W: LayoutElement> Tile<W> {
563563 size
564564 }
565565
566- fn animated_window_size(&self) -> Size<f64, Logical> {
566+ pub fn animated_window_size(&self) -> Size<f64, Logical> {
567567 let mut size = self.window_size();
568568
569569 if let Some(resize) = &self.resize_animation {
@@ -580,7 +580,7 @@ impl<W: LayoutElement> Tile<W> {
580580 size
581581 }
582582
583- fn animated_tile_size(&self) -> Size<f64, Logical> {
583+ pub fn animated_tile_size(&self) -> Size<f64, Logical> {
584584 let mut size = self.animated_window_size();
585585
586586 if self.is_fullscreen {
@@ -1031,6 +1031,14 @@ impl<W: LayoutElement> Tile<W> {
10311031 self.unmap_snapshot.take()
10321032 }
10331033
1034+ pub fn border(&self) -> &FocusRing {
1035+ &self.border
1036+ }
1037+
1038+ pub fn focus_ring(&self) -> &FocusRing {
1039+ &self.focus_ring
1040+ }
1041+
10341042 pub fn options(&self) -> &Rc<Options> {
10351043 &self.options
10361044 }
src/utils/mod.rsmodified+8 -0
@@ -127,6 +127,14 @@ pub fn round_logical_in_physical_max1(scale: f64, logical: f64) -> f64 {
127127 (logical * scale).max(1.).round() / scale
128128 }
129129
130+pub fn floor_logical_in_physical_max1(scale: f64, logical: f64) -> f64 {
131+ if logical == 0. {
132+ return 0.;
133+ }
134+
135+ (logical * scale).max(1.).floor() / scale
136+}
137+
130138 pub fn output_size(output: &Output) -> Size<f64, Logical> {
131139 let output_scale = output.current_scale().fractional_scale();
132140 let output_transform = output.current_transform();
src/window/mod.rsmodified+10 -1
@@ -2,7 +2,7 @@ use std::cmp::{max, min};
22
33 use niri_config::{
44 BlockOutFrom, BorderRule, CornerRadius, FloatingPosition, Match, PresetSize, ShadowRule,
5- WindowRule,
5+ TabIndicatorRule, WindowRule,
66 };
77 use niri_ipc::ColumnDisplay;
88 use smithay::reexports::wayland_protocols::xdg::shell::server::xdg_toplevel;
@@ -83,6 +83,8 @@ pub struct ResolvedWindowRules {
8383 pub border: BorderRule,
8484 /// Shadow overrides.
8585 pub shadow: ShadowRule,
86+ /// Tab indicator overrides.
87+ pub tab_indicator: TabIndicatorRule,
8688
8789 /// Whether or not to draw the border with a solid background.
8890 ///
@@ -191,6 +193,12 @@ impl ResolvedWindowRules {
191193 color: None,
192194 inactive_color: None,
193195 },
196+ tab_indicator: TabIndicatorRule {
197+ active_color: None,
198+ inactive_color: None,
199+ active_gradient: None,
200+ inactive_gradient: None,
201+ },
194202 draw_border_with_background: None,
195203 opacity: None,
196204 geometry_corner_radius: None,
@@ -290,6 +298,7 @@ impl ResolvedWindowRules {
290298 resolved.focus_ring.merge_with(&rule.focus_ring);
291299 resolved.border.merge_with(&rule.border);
292300 resolved.shadow.merge_with(&rule.shadow);
301+ resolved.tab_indicator.merge_with(&rule.tab_indicator);
293302
294303 if let Some(x) = rule.draw_border_with_background {
295304 resolved.draw_border_with_background = Some(x);