mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-24 02:01:18 +07:00
Add backdrop-color setting to overview {}
This commit is contained in:
+13
-9
@@ -447,8 +447,8 @@ pub struct Output {
|
|||||||
pub focus_at_startup: bool,
|
pub focus_at_startup: bool,
|
||||||
#[knuffel(child, default = DEFAULT_BACKGROUND_COLOR)]
|
#[knuffel(child, default = DEFAULT_BACKGROUND_COLOR)]
|
||||||
pub background_color: Color,
|
pub background_color: Color,
|
||||||
#[knuffel(child, default = DEFAULT_BACKDROP_COLOR)]
|
#[knuffel(child)]
|
||||||
pub backdrop_color: Color,
|
pub backdrop_color: Option<Color>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Output {
|
impl Output {
|
||||||
@@ -477,7 +477,7 @@ impl Default for Output {
|
|||||||
mode: None,
|
mode: None,
|
||||||
variable_refresh_rate: None,
|
variable_refresh_rate: None,
|
||||||
background_color: DEFAULT_BACKGROUND_COLOR,
|
background_color: DEFAULT_BACKGROUND_COLOR,
|
||||||
backdrop_color: DEFAULT_BACKDROP_COLOR,
|
backdrop_color: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1264,12 +1264,15 @@ pub struct HotCorners {
|
|||||||
pub struct Overview {
|
pub struct Overview {
|
||||||
#[knuffel(child, unwrap(argument), default = Self::default().zoom)]
|
#[knuffel(child, unwrap(argument), default = Self::default().zoom)]
|
||||||
pub zoom: FloatOrInt<0, 1>,
|
pub zoom: FloatOrInt<0, 1>,
|
||||||
|
#[knuffel(child, default = Self::default().backdrop_color)]
|
||||||
|
pub backdrop_color: Color,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Overview {
|
impl Default for Overview {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
zoom: FloatOrInt(0.5),
|
zoom: FloatOrInt(0.5),
|
||||||
|
backdrop_color: DEFAULT_BACKDROP_COLOR,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4225,12 +4228,7 @@ mod tests {
|
|||||||
b: 0.4,
|
b: 0.4,
|
||||||
a: 1.0,
|
a: 1.0,
|
||||||
},
|
},
|
||||||
backdrop_color: Color {
|
backdrop_color: None,
|
||||||
r: 0.15,
|
|
||||||
g: 0.15,
|
|
||||||
b: 0.15,
|
|
||||||
a: 1.0,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -4603,6 +4601,12 @@ mod tests {
|
|||||||
zoom: FloatOrInt(
|
zoom: FloatOrInt(
|
||||||
0.5,
|
0.5,
|
||||||
),
|
),
|
||||||
|
backdrop_color: Color {
|
||||||
|
r: 0.15,
|
||||||
|
g: 0.15,
|
||||||
|
b: 0.15,
|
||||||
|
a: 1.0,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
environment: Environment(
|
environment: Environment(
|
||||||
[
|
[
|
||||||
|
|||||||
+12
-7
@@ -15,7 +15,7 @@ use anyhow::{bail, ensure, Context};
|
|||||||
use calloop::futures::Scheduler;
|
use calloop::futures::Scheduler;
|
||||||
use niri_config::{
|
use niri_config::{
|
||||||
Config, FloatOrInt, Key, Modifiers, OutputName, PreviewRender, TrackLayout,
|
Config, FloatOrInt, Key, Modifiers, OutputName, PreviewRender, TrackLayout,
|
||||||
WarpMouseToFocusMode, WorkspaceReference, DEFAULT_BACKDROP_COLOR, DEFAULT_BACKGROUND_COLOR,
|
WarpMouseToFocusMode, WorkspaceReference, DEFAULT_BACKGROUND_COLOR,
|
||||||
};
|
};
|
||||||
use smithay::backend::allocator::Fourcc;
|
use smithay::backend::allocator::Fourcc;
|
||||||
use smithay::backend::input::Keycode;
|
use smithay::backend::input::Keycode;
|
||||||
@@ -1394,6 +1394,11 @@ impl State {
|
|||||||
output_config_changed = true;
|
output_config_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: move backdrop rendering into layout::Monitor, then this will become unnecessary.
|
||||||
|
if config.overview.backdrop_color != old_config.overview.backdrop_color {
|
||||||
|
output_config_changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
*old_config = config;
|
*old_config = config;
|
||||||
|
|
||||||
if let Some(outputs) = preserved_output_config {
|
if let Some(outputs) = preserved_output_config {
|
||||||
@@ -1471,8 +1476,8 @@ impl State {
|
|||||||
|
|
||||||
for output in self.niri.global_space.outputs() {
|
for output in self.niri.global_space.outputs() {
|
||||||
let name = output.user_data().get::<OutputName>().unwrap();
|
let name = output.user_data().get::<OutputName>().unwrap();
|
||||||
let config = self.niri.config.borrow_mut();
|
let full_config = self.niri.config.borrow_mut();
|
||||||
let config = config.outputs.find(name);
|
let config = full_config.outputs.find(name);
|
||||||
|
|
||||||
let scale = config
|
let scale = config
|
||||||
.and_then(|c| c.scale)
|
.and_then(|c| c.scale)
|
||||||
@@ -1513,8 +1518,8 @@ impl State {
|
|||||||
let background_color = Color32F::from(background_color);
|
let background_color = Color32F::from(background_color);
|
||||||
|
|
||||||
let mut backdrop_color = config
|
let mut backdrop_color = config
|
||||||
.map(|c| c.backdrop_color)
|
.and_then(|c| c.backdrop_color)
|
||||||
.unwrap_or(DEFAULT_BACKDROP_COLOR)
|
.unwrap_or(full_config.overview.backdrop_color)
|
||||||
.to_array_unpremul();
|
.to_array_unpremul();
|
||||||
backdrop_color[3] = 1.;
|
backdrop_color[3] = 1.;
|
||||||
let backdrop_color = Color32F::from(backdrop_color);
|
let backdrop_color = Color32F::from(backdrop_color);
|
||||||
@@ -2701,8 +2706,8 @@ impl Niri {
|
|||||||
background_color[3] = 1.;
|
background_color[3] = 1.;
|
||||||
|
|
||||||
let mut backdrop_color = c
|
let mut backdrop_color = c
|
||||||
.map(|c| c.backdrop_color)
|
.and_then(|c| c.backdrop_color)
|
||||||
.unwrap_or(DEFAULT_BACKDROP_COLOR)
|
.unwrap_or(config.overview.backdrop_color)
|
||||||
.to_array_unpremul();
|
.to_array_unpremul();
|
||||||
backdrop_color[3] = 1.;
|
backdrop_color[3] = 1.;
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ cursor {
|
|||||||
|
|
||||||
overview {
|
overview {
|
||||||
zoom 0.5
|
zoom 0.5
|
||||||
|
backdrop-color "#262626"
|
||||||
}
|
}
|
||||||
|
|
||||||
clipboard {
|
clipboard {
|
||||||
@@ -161,6 +162,17 @@ overview {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`backdrop-color` sets the backdrop color behind workspaces in the overview.
|
||||||
|
The backdrop is also visible between workspaces when switching.
|
||||||
|
|
||||||
|
The alpha channel for this color will be ignored.
|
||||||
|
|
||||||
|
```kdl
|
||||||
|
overview {
|
||||||
|
backdrop-color "#262626"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### `clipboard`
|
### `clipboard`
|
||||||
|
|
||||||
<sup>Since: 25.02</sup>
|
<sup>Since: 25.02</sup>
|
||||||
|
|||||||
+8
-8
@@ -38,6 +38,14 @@ overview {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To change the color behind the workspaces, use the `backdrop-color` setting:
|
||||||
|
|
||||||
|
```kdl
|
||||||
|
overview {
|
||||||
|
backdrop-color "#777777"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
You can also disable the hot corner:
|
You can also disable the hot corner:
|
||||||
|
|
||||||
```kdl
|
```kdl
|
||||||
@@ -48,11 +56,3 @@ gestures {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
To change the color behind the workspaces, use the `backdrop-color` output setting:
|
|
||||||
|
|
||||||
```kdl
|
|
||||||
output "HDMI-A-1" {
|
|
||||||
backdrop-color "#777777"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
Reference in New Issue
Block a user