diff options
| author | Duncan Overbruck <mail@duncano.de> | 2025-03-22 19:04:24 +0100 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-05-10 12:14:41 -0700 |
| commit | 398bc78ea073e0e61c6ba67ddcbaad0a5d574eeb (patch) | |
| tree | 67030b91b3b05d07df219e3512c4b6046a6bc0a3 /niri-config/src | |
| parent | caa6189448cbf338c18fe6afe313f577c8378b31 (diff) | |
| download | niri-398bc78ea073e0e61c6ba67ddcbaad0a5d574eeb.tar.gz niri-398bc78ea073e0e61c6ba67ddcbaad0a5d574eeb.tar.bz2 niri-398bc78ea073e0e61c6ba67ddcbaad0a5d574eeb.zip | |
add urgent border color and gradient
Diffstat (limited to 'niri-config/src')
| -rw-r--r-- | niri-config/src/lib.rs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index 257c78ed..287b630d 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -583,10 +583,14 @@ pub struct FocusRing { pub active_color: Color, #[knuffel(child, default = Self::default().inactive_color)] pub inactive_color: Color, + #[knuffel(child, default = Self::default().urgent_color)] + pub urgent_color: Color, #[knuffel(child)] pub active_gradient: Option<Gradient>, #[knuffel(child)] pub inactive_gradient: Option<Gradient>, + #[knuffel(child)] + pub urgent_gradient: Option<Gradient>, } impl Default for FocusRing { @@ -596,8 +600,10 @@ impl Default for FocusRing { width: FloatOrInt(4.), active_color: Color::from_rgba8_unpremul(127, 200, 255, 255), inactive_color: Color::from_rgba8_unpremul(80, 80, 80, 255), + urgent_color: Color::from_rgba8_unpremul(155, 0, 0, 255), active_gradient: None, inactive_gradient: None, + urgent_gradient: None, } } } @@ -669,10 +675,14 @@ pub struct Border { pub active_color: Color, #[knuffel(child, default = Self::default().inactive_color)] pub inactive_color: Color, + #[knuffel(child, default = Self::default().urgent_color)] + pub urgent_color: Color, #[knuffel(child)] pub active_gradient: Option<Gradient>, #[knuffel(child)] pub inactive_gradient: Option<Gradient>, + #[knuffel(child)] + pub urgent_gradient: Option<Gradient>, } impl Default for Border { @@ -682,8 +692,10 @@ impl Default for Border { width: FloatOrInt(4.), active_color: Color::from_rgba8_unpremul(255, 200, 127, 255), inactive_color: Color::from_rgba8_unpremul(80, 80, 80, 255), + urgent_color: Color::from_rgba8_unpremul(155, 0, 0, 255), active_gradient: None, inactive_gradient: None, + urgent_gradient: None, } } } @@ -695,8 +707,10 @@ impl From<Border> for FocusRing { width: value.width, active_color: value.active_color, inactive_color: value.inactive_color, + urgent_color: value.urgent_color, active_gradient: value.active_gradient, inactive_gradient: value.inactive_gradient, + urgent_gradient: value.urgent_gradient, } } } @@ -708,8 +722,10 @@ impl From<FocusRing> for Border { width: value.width, active_color: value.active_color, inactive_color: value.inactive_color, + urgent_color: value.urgent_color, active_gradient: value.active_gradient, inactive_gradient: value.inactive_gradient, + urgent_gradient: value.urgent_gradient, } } } @@ -1487,9 +1503,13 @@ pub struct BorderRule { #[knuffel(child)] pub inactive_color: Option<Color>, #[knuffel(child)] + pub urgent_color: Option<Color>, + #[knuffel(child)] pub active_gradient: Option<Gradient>, #[knuffel(child)] pub inactive_gradient: Option<Gradient>, + #[knuffel(child)] + pub urgent_gradient: Option<Gradient>, } #[derive(knuffel::Decode, Debug, Default, Clone, Copy, PartialEq)] @@ -2353,12 +2373,18 @@ impl BorderRule { if let Some(x) = other.inactive_color { self.inactive_color = Some(x); } + if let Some(x) = other.urgent_color { + self.urgent_color = Some(x); + } if let Some(x) = other.active_gradient { self.active_gradient = Some(x); } if let Some(x) = other.inactive_gradient { self.inactive_gradient = Some(x); } + if let Some(x) = other.urgent_gradient { + self.urgent_gradient = Some(x); + } } pub fn resolve_against(&self, mut config: Border) -> Border { @@ -2378,12 +2404,19 @@ impl BorderRule { config.inactive_color = x; config.inactive_gradient = None; } + if let Some(x) = self.urgent_color { + config.urgent_color = x; + config.urgent_gradient = None; + } if let Some(x) = self.active_gradient { config.active_gradient = Some(x); } if let Some(x) = self.inactive_gradient { config.inactive_gradient = Some(x); } + if let Some(x) = self.urgent_gradient { + config.urgent_gradient = Some(x); + } config } @@ -4321,6 +4354,12 @@ mod tests { b: 0.39215687, a: 0.0, }, + urgent_color: Color { + r: 0.60784316, + g: 0.0, + b: 0.0, + a: 1.0, + }, active_gradient: Some( Gradient { from: Color { @@ -4344,6 +4383,7 @@ mod tests { }, ), inactive_gradient: None, + urgent_gradient: None, }, border: Border { off: false, @@ -4362,8 +4402,15 @@ mod tests { b: 0.39215687, a: 0.0, }, + urgent_color: Color { + r: 0.60784316, + g: 0.0, + b: 0.0, + a: 1.0, + }, active_gradient: None, inactive_gradient: None, + urgent_gradient: None, }, shadow: Shadow { on: false, @@ -4805,8 +4852,10 @@ mod tests { ), active_color: None, inactive_color: None, + urgent_color: None, active_gradient: None, inactive_gradient: None, + urgent_gradient: None, }, border: BorderRule { off: false, @@ -4818,8 +4867,10 @@ mod tests { ), active_color: None, inactive_color: None, + urgent_color: None, active_gradient: None, inactive_gradient: None, + urgent_gradient: None, }, shadow: ShadowRule { off: false, @@ -5552,8 +5603,10 @@ mod tests { width: None, active_color: None, inactive_color: None, + urgent_color: None, active_gradient: None, inactive_gradient: None, + urgent_gradient: None, }; for rule in rules.iter().copied() { |
