move material symbol in Network service to Icon

This commit is contained in:
end-4
2026-03-11 21:55:56 +01:00
parent 68a51b79ff
commit b4c8a63d1a
6 changed files with 23 additions and 22 deletions
@@ -3,6 +3,7 @@ pragma Singleton
// From https://github.com/caelestia-dots/shell (GPLv3)
import Quickshell
import qs.services
Singleton {
id: root
@@ -21,6 +22,24 @@ Singleton {
return "bluetooth";
}
function getNetworkMaterialSymbol() {
if (Network.ethernet) return "lan";
if (Network.wifiEnabled && Network.wifiStatus === "connected") {
const strength = Network.active?.strength ?? 0
if (strength > 83) return "signal_wifi_4_bar";
if (strength > 67) return "network_wifi";
if (strength > 50) return "network_wifi_3_bar";
if (strength > 33) return "network_wifi_2_bar";
if (strength > 17) return "network_wifi_1_bar";
return "signal_wifi_0_bar"
} else {
if (Network.wifiStatus === "connecting") return "signal_wifi_statusbar_not_connected";
if (Network.wifiStatus === "disconnected") return "wifi_find";
if (Network.wifiStatus === "disabled") return "signal_wifi_off";
return "signal_wifi_bad";
}
}
readonly property var weatherIconMap: ({
"113": "clear_day",
"116": "partly_cloudy_day",
@@ -8,7 +8,7 @@ QuickToggleModel {
name: Translation.tr("Internet")
statusText: Network.networkName
tooltipText: Translation.tr("%1 | Right-click to configure").arg(Network.networkName)
icon: Network.materialSymbol
icon: Icons.getNetworkMaterialSymbol()
toggled: Network.wifiStatus !== "disabled"
mainAction: () => Network.toggleWifi()
@@ -303,7 +303,7 @@ Item { // Bar content region
}
}
MaterialSymbol {
text: Network.materialSymbol
text: Icons.getNetworkMaterialSymbol()
iconSize: Appearance.font.pixelSize.larger
color: rightSidebarButton.colText
}
@@ -11,7 +11,7 @@ import Quickshell.Hyprland
QuickToggleButton {
toggled: Network.wifiStatus !== "disabled"
buttonIcon: Network.materialSymbol
buttonIcon: Icons.getNetworkMaterialSymbol()
onClicked: Network.toggleWifi()
altAction: () => {
Quickshell.execDetached(["bash", "-c", `${Network.ethernet ? Config.options.apps.networkEthernet : Config.options.apps.network}`])
@@ -280,7 +280,7 @@ Item { // Bar content region
}
}
MaterialSymbol {
text: Network.materialSymbol
text: Icons.getNetworkMaterialSymbol()
iconSize: Appearance.font.pixelSize.larger
color: rightSidebarButton.colText
}