mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-22 02:01:55 +07:00
add urgent border color and gradient
This commit is contained in:
committed by
Ivan Molodetskikh
parent
caa6189448
commit
398bc78ea0
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user