diff --git a/docs/wiki/Configuration:-Layout.md b/docs/wiki/Configuration:-Layout.md index 55016d3a..f769b7bd 100644 --- a/docs/wiki/Configuration:-Layout.md +++ b/docs/wiki/Configuration:-Layout.md @@ -12,6 +12,7 @@ layout { empty-workspace-above-first default-column-display "tabbed" background-color "#003300" + fullscreen-backdrop-color "#000000ff" preset-column-widths { proportion 0.33333 @@ -561,3 +562,19 @@ layout { ``` You can also set the color per-output [in the output config](./Configuration:-Outputs.md#layout-config-overrides). + +### `fullscreen-backdrop-color` + +Since: next release + +Set the backdrop color that niri draws behind fullscreen windows. +By default, it is black. + +You can set this to `"transparent"`, or just a transparent color, to enable transparency for fullscreen windows. + +```kdl +// Let fullscreen windows be semitransparent. +layout { + fullscreen-backdrop-color "transparent" +} +``` diff --git a/niri-config/src/layout.rs b/niri-config/src/layout.rs index f84528bd..dad95205 100644 --- a/niri-config/src/layout.rs +++ b/niri-config/src/layout.rs @@ -24,6 +24,7 @@ pub struct Layout { pub gaps: f64, pub struts: Struts, pub background_color: Color, + pub fullscreen_backdrop_color: Color, } impl Default for Layout { @@ -52,6 +53,7 @@ impl Default for Layout { PresetSize::Proportion(2. / 3.), ], background_color: DEFAULT_BACKGROUND_COLOR, + fullscreen_backdrop_color: Color::from_array_unpremul([0., 0., 0., 1.]), } } } @@ -78,6 +80,7 @@ impl MergeWith for Layout { default_column_display, struts, background_color, + fullscreen_backdrop_color, ); if let Some(x) = part.default_column_width { @@ -126,6 +129,8 @@ pub struct LayoutPart { pub struts: Option, #[knuffel(child)] pub background_color: Option, + #[knuffel(child)] + pub fullscreen_backdrop_color: Option, } #[derive(knuffel::Decode, Debug, Clone, Copy, PartialEq)] diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index 22e0d3db..80b2cff5 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -1507,6 +1507,12 @@ mod tests { b: 0.25, a: 1.0, }, + fullscreen_backdrop_color: Color { + r: 0.0, + g: 0.0, + b: 0.0, + a: 1.0, + }, }, prefer_no_csd: true, cursor: Cursor { diff --git a/src/layout/tile.rs b/src/layout/tile.rs index db8ce678..7e9b653f 100644 --- a/src/layout/tile.rs +++ b/src/layout/tile.rs @@ -56,7 +56,7 @@ pub struct Tile { /// right away, to avoid black backdrop flicker before the window has had a chance to resize. sizing_mode: SizingMode, - /// The black backdrop for fullscreen windows. + /// The backdrop for fullscreen windows. fullscreen_backdrop: SolidColorBuffer, /// Whether the tile should float upon unfullscreening. @@ -191,6 +191,7 @@ impl Tile { let focus_ring_config = options.layout.focus_ring.merged_with(&rules.focus_ring); let shadow_config = options.layout.shadow.merged_with(&rules.shadow); let sizing_mode = window.sizing_mode(); + let fullscreen_backdrop_color = options.layout.fullscreen_backdrop_color; Self { window, @@ -198,7 +199,7 @@ impl Tile { focus_ring: FocusRing::new(focus_ring_config), shadow: Shadow::new(shadow_config), sizing_mode, - fullscreen_backdrop: SolidColorBuffer::new((0., 0.), [0., 0., 0., 1.]), + fullscreen_backdrop: SolidColorBuffer::new((0., 0.), fullscreen_backdrop_color), restore_to_floating: false, floating_window_size: None, floating_pos: None, @@ -237,6 +238,9 @@ impl Tile { self.scale = scale; self.options = options; + self.fullscreen_backdrop + .set_color(self.options.layout.fullscreen_backdrop_color); + let round_max1 = |logical| round_logical_in_physical_max1(self.scale, logical); let rules = self.window.rules();