Glass designs as settings: solid, frosted, liquid on every surface

appearance.surface.design picks the look (chips in the config window); each
design's opacity, rim and light are settings. surface::shell now draws the
island, idle pill, workspace and tray pills, tray menu, control centre and
popup, so a design applies everywhere. On see-through glass faces fade with
.opacity(). Shell text settings can list their allowed words (chips).
This commit is contained in:
server2
2026-10-15 03:05:06 +02:00
parent 7d8525e95c
commit 5d322b940d
10 changed files with 203 additions and 96 deletions
+33 -10
View File
@@ -480,6 +480,14 @@ fn shell_row(option: &'static Opt, width: f32, colors: &Colors) -> Rectangle {
Box::new(switch(on, move || say(config::set(option.path, Value::Bool(!on)), format!("{} = {}", option.path, !on))))
}
(Kind::Text, Value::Text(current)) if !option.choices.is_empty() => Box::new(chips(
option
.choices
.iter()
.map(|&word| (String::from(word), current == word, Box::new(move || say(config::set(option.path, Value::Text(String::from(word))), format!("{} = {word}", option.path))) as Box<dyn Fn()>))
.collect(),
colors,
)),
(Kind::Int | Kind::Float, _) if option.range.is_some() => {
let (min, max) = option.range.unwrap_or((0.0, 1.0));
let whole = option.kind == Kind::Int;
@@ -514,8 +522,6 @@ fn shell_row(option: &'static Opt, width: f32, colors: &Colors) -> Rectangle {
help.push_str(&format!(" · default {}", config::shown(&(option.default)())));
}
let _ = colors;
row(config::label(option.name()), option.path.to_string(), help, control, reset, width)
}
@@ -633,14 +639,31 @@ fn slider(fraction: f64, pick: impl Fn(f64) + Clone + 'static) -> Rectangle {
}
// a Hyprland number with named values: one chip per name
// a Hyprland option's named values as chips
fn choices(option: &HyprOption, colors: &Colors) -> Row {
let name = option.name;
let chips: Vec<Box<dyn Widget>> = option
.choices
.iter()
.map(|(label, value)| {
let chosen = option.current == value.to_string();
let value = value.to_string();
chips(
option
.choices
.iter()
.map(|(label, value)| {
let value = value.to_string();
(label.replace('_', " "), option.current == value, Box::new(move || hypr::set(name, &value)) as Box<dyn Fn()>)
})
.collect(),
colors,
)
}
// one choice: its label, whether it's the current one, what a click does
type Choice = (String, bool, Box<dyn Fn()>);
fn chips(items: Vec<Choice>, colors: &Colors) -> Row {
let chips: Vec<Box<dyn Widget>> = items
.into_iter()
.map(|(label, chosen, pick)| {
let letters = label.chars().count() as f32;
Box::new(
@@ -651,8 +674,8 @@ fn choices(option: &HyprOption, colors: &Colors) -> Row {
.fill(if chosen { colors.accent } else { config::appearance::overlays::chip() })
.align_child(Center, Center)
.cursor(Cursor::Pointer)
.on_click(move |_| hypr::set(name, &value))
.child(Text::new(label.replace('_', " ")).size(config::appearance::text::small()).color(if chosen { colors.on_accent } else { colors.text })),
.on_click(move |_| pick())
.child(Text::new(label).size(config::appearance::text::small()).color(if chosen { colors.on_accent } else { colors.text })),
) as Box<dyn Widget>
})
.collect();