forge
Explore
Log in

Don't you dare go Hollow

Allow customising the color of the fullscreen backdrop

Browse files at this commit

58d213e6e910a825ecf374d3903ee5a3d71abaa2rolvParent: 7d9d0f2
  • feat
    • allow customising the color of the fullscreen backdrop
Show full message
feat: allow customising the color of the fullscreen backdrop
docs/wiki/Configuration:-Layout.mdmodified+17 -0
@@ -12,6 +12,7 @@ layout {
12 empty-workspace-above-first12 empty-workspace-above-first
13 default-column-display "tabbed"13 default-column-display "tabbed"
14 background-color "#003300"14 background-color "#003300"
15+ fullscreen-backdrop-color "#000000ff"
15 16
16 preset-column-widths {17 preset-column-widths {
17 proportion 0.3333318 proportion 0.33333
@@ -561,3 +562,19 @@ layout {
561 ```562 ```
562 563
563 You can also set the color per-output [in the output config](./Configuration:-Outputs.md#layout-config-overrides).564 You can also set the color per-output [in the output config](./Configuration:-Outputs.md#layout-config-overrides).
565+
566+### `fullscreen-backdrop-color`
567+
568+<sup>Since: next release</sup>
569+
570+Set the backdrop color that niri draws behind fullscreen windows.
571+By default, it is black.
572+
573+You can set this to `"transparent"`, or just a transparent color, to enable transparency for fullscreen windows.
574+
575+```kdl
576+// Let fullscreen windows be semitransparent.
577+layout {
578+ fullscreen-backdrop-color "transparent"
579+}
580+```
niri-config/src/layout.rsmodified+5 -0
@@ -24,6 +24,7 @@ pub struct Layout {
24 pub gaps: f64,24 pub gaps: f64,
25 pub struts: Struts,25 pub struts: Struts,
26 pub background_color: Color,26 pub background_color: Color,
27+ pub fullscreen_backdrop_color: Color,
27 }28 }
28 29
29 impl Default for Layout {30 impl Default for Layout {
@@ -52,6 +53,7 @@ impl Default for Layout {
52 PresetSize::Proportion(2. / 3.),53 PresetSize::Proportion(2. / 3.),
53 ],54 ],
54 background_color: DEFAULT_BACKGROUND_COLOR,55 background_color: DEFAULT_BACKGROUND_COLOR,
56+ fullscreen_backdrop_color: Color::from_array_unpremul([0., 0., 0., 1.]),
55 }57 }
56 }58 }
57 }59 }
@@ -78,6 +80,7 @@ impl MergeWith<LayoutPart> for Layout {
78 default_column_display,80 default_column_display,
79 struts,81 struts,
80 background_color,82 background_color,
83+ fullscreen_backdrop_color,
81 );84 );
82 85
83 if let Some(x) = part.default_column_width {86 if let Some(x) = part.default_column_width {
@@ -126,6 +129,8 @@ pub struct LayoutPart {
126 pub struts: Option<Struts>,129 pub struts: Option<Struts>,
127 #[knuffel(child)]130 #[knuffel(child)]
128 pub background_color: Option<Color>,131 pub background_color: Option<Color>,
132+ #[knuffel(child)]
133+ pub fullscreen_backdrop_color: Option<Color>,
129 }134 }
130 135
131 #[derive(knuffel::Decode, Debug, Clone, Copy, PartialEq)]136 #[derive(knuffel::Decode, Debug, Clone, Copy, PartialEq)]
niri-config/src/lib.rsmodified+6 -0
@@ -1507,6 +1507,12 @@ mod tests {
1507 b: 0.25,1507 b: 0.25,
1508 a: 1.0,1508 a: 1.0,
1509 },1509 },
1510+ fullscreen_backdrop_color: Color {
1511+ r: 0.0,
1512+ g: 0.0,
1513+ b: 0.0,
1514+ a: 1.0,
1515+ },
1510 },1516 },
1511 prefer_no_csd: true,1517 prefer_no_csd: true,
1512 cursor: Cursor {1518 cursor: Cursor {
src/layout/tile.rsmodified+6 -2
@@ -56,7 +56,7 @@ pub struct Tile<W: LayoutElement> {
56 /// right away, to avoid black backdrop flicker before the window has had a chance to resize.56 /// right away, to avoid black backdrop flicker before the window has had a chance to resize.
57 sizing_mode: SizingMode,57 sizing_mode: SizingMode,
58 58
59- /// The black backdrop for fullscreen windows.59+ /// The backdrop for fullscreen windows.
60 fullscreen_backdrop: SolidColorBuffer,60 fullscreen_backdrop: SolidColorBuffer,
61 61
62 /// Whether the tile should float upon unfullscreening.62 /// Whether the tile should float upon unfullscreening.
@@ -191,6 +191,7 @@ impl<W: LayoutElement> Tile<W> {
191 let focus_ring_config = options.layout.focus_ring.merged_with(&rules.focus_ring);191 let focus_ring_config = options.layout.focus_ring.merged_with(&rules.focus_ring);
192 let shadow_config = options.layout.shadow.merged_with(&rules.shadow);192 let shadow_config = options.layout.shadow.merged_with(&rules.shadow);
193 let sizing_mode = window.sizing_mode();193 let sizing_mode = window.sizing_mode();
194+ let fullscreen_backdrop_color = options.layout.fullscreen_backdrop_color;
194 195
195 Self {196 Self {
196 window,197 window,
@@ -198,7 +199,7 @@ impl<W: LayoutElement> Tile<W> {
198 focus_ring: FocusRing::new(focus_ring_config),199 focus_ring: FocusRing::new(focus_ring_config),
199 shadow: Shadow::new(shadow_config),200 shadow: Shadow::new(shadow_config),
200 sizing_mode,201 sizing_mode,
201- fullscreen_backdrop: SolidColorBuffer::new((0., 0.), [0., 0., 0., 1.]),202+ fullscreen_backdrop: SolidColorBuffer::new((0., 0.), fullscreen_backdrop_color),
202 restore_to_floating: false,203 restore_to_floating: false,
203 floating_window_size: None,204 floating_window_size: None,
204 floating_pos: None,205 floating_pos: None,
@@ -237,6 +238,9 @@ impl<W: LayoutElement> Tile<W> {
237 self.scale = scale;238 self.scale = scale;
238 self.options = options;239 self.options = options;
239 240
241+ self.fullscreen_backdrop
242+ .set_color(self.options.layout.fullscreen_backdrop_color);
243+
240 let round_max1 = |logical| round_logical_in_physical_max1(self.scale, logical);244 let round_max1 = |logical| round_logical_in_physical_max1(self.scale, logical);
241 245
242 let rules = self.window.rules();246 let rules = self.window.rules();