Skip to content

Commit b8327fb

Browse files
git-f0xmmstick
authored andcommitted
fix(wifi): adaptive wifi icons
1 parent fa22b55 commit b8327fb

File tree

1 file changed

+13
-1
lines changed
  • cosmic-settings/src/pages/networking

1 file changed

+13
-1
lines changed

cosmic-settings/src/pages/networking/wifi.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ fn devices_view() -> Section<crate::pages::Message> {
590590
};
591591

592592
let identifier = widget::row::with_capacity(3)
593-
.push(widget::icon::from_name("network-wireless-good-symbolic"))
593+
.push(widget::icon::from_name(wifi_icon(network.strength)))
594594
.push_maybe(
595595
is_encrypted
596596
.then(|| widget::icon::from_name("connection-secure-symbolic")),
@@ -785,3 +785,15 @@ pub fn update_devices(conn: zbus::Connection) -> Command<crate::app::Message> {
785785
}
786786
})
787787
}
788+
789+
fn wifi_icon(strength: u8) -> &'static str {
790+
if strength < 25 {
791+
"network-wireless-signal-weak-symbolic"
792+
} else if strength < 50 {
793+
"network-wireless-signal-ok-symbolic"
794+
} else if strength < 75 {
795+
"network-wireless-signal-good-symbolic"
796+
} else {
797+
"network-wireless-signal-excellent-symbolic"
798+
}
799+
}

0 commit comments

Comments
 (0)