fix(wifi): adaptive wifi icons
This commit is contained in:
parent
fa22b556dd
commit
b8327fb1b5
1 changed files with 13 additions and 1 deletions
|
|
@ -590,7 +590,7 @@ fn devices_view() -> Section<crate::pages::Message> {
|
|||
};
|
||||
|
||||
let identifier = widget::row::with_capacity(3)
|
||||
.push(widget::icon::from_name("network-wireless-good-symbolic"))
|
||||
.push(widget::icon::from_name(wifi_icon(network.strength)))
|
||||
.push_maybe(
|
||||
is_encrypted
|
||||
.then(|| widget::icon::from_name("connection-secure-symbolic")),
|
||||
|
|
@ -785,3 +785,15 @@ pub fn update_devices(conn: zbus::Connection) -> Command<crate::app::Message> {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn wifi_icon(strength: u8) -> &'static str {
|
||||
if strength < 25 {
|
||||
"network-wireless-signal-weak-symbolic"
|
||||
} else if strength < 50 {
|
||||
"network-wireless-signal-ok-symbolic"
|
||||
} else if strength < 75 {
|
||||
"network-wireless-signal-good-symbolic"
|
||||
} else {
|
||||
"network-wireless-signal-excellent-symbolic"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue