diff --git a/dots/.config/quickshell/ii/modules/common/Icons.qml b/dots/.config/quickshell/ii/modules/common/Icons.qml index 9858d2963..96a745b9f 100644 --- a/dots/.config/quickshell/ii/modules/common/Icons.qml +++ b/dots/.config/quickshell/ii/modules/common/Icons.qml @@ -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", diff --git a/dots/.config/quickshell/ii/modules/common/models/quickToggles/NetworkToggle.qml b/dots/.config/quickshell/ii/modules/common/models/quickToggles/NetworkToggle.qml index f6f412d01..70eff0e8f 100644 --- a/dots/.config/quickshell/ii/modules/common/models/quickToggles/NetworkToggle.qml +++ b/dots/.config/quickshell/ii/modules/common/models/quickToggles/NetworkToggle.qml @@ -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() diff --git a/dots/.config/quickshell/ii/modules/ii/bar/BarContent.qml b/dots/.config/quickshell/ii/modules/ii/bar/BarContent.qml index 2a72e3382..c000ef8bf 100644 --- a/dots/.config/quickshell/ii/modules/ii/bar/BarContent.qml +++ b/dots/.config/quickshell/ii/modules/ii/bar/BarContent.qml @@ -303,7 +303,7 @@ Item { // Bar content region } } MaterialSymbol { - text: Network.materialSymbol + text: Icons.getNetworkMaterialSymbol() iconSize: Appearance.font.pixelSize.larger color: rightSidebarButton.colText } diff --git a/dots/.config/quickshell/ii/modules/ii/sidebarRight/quickToggles/classicStyle/NetworkToggle.qml b/dots/.config/quickshell/ii/modules/ii/sidebarRight/quickToggles/classicStyle/NetworkToggle.qml index 63fdb85bc..8285cefed 100644 --- a/dots/.config/quickshell/ii/modules/ii/sidebarRight/quickToggles/classicStyle/NetworkToggle.qml +++ b/dots/.config/quickshell/ii/modules/ii/sidebarRight/quickToggles/classicStyle/NetworkToggle.qml @@ -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}`]) diff --git a/dots/.config/quickshell/ii/modules/ii/verticalBar/VerticalBarContent.qml b/dots/.config/quickshell/ii/modules/ii/verticalBar/VerticalBarContent.qml index 69ffc4bbe..e022399f7 100644 --- a/dots/.config/quickshell/ii/modules/ii/verticalBar/VerticalBarContent.qml +++ b/dots/.config/quickshell/ii/modules/ii/verticalBar/VerticalBarContent.qml @@ -280,7 +280,7 @@ Item { // Bar content region } } MaterialSymbol { - text: Network.materialSymbol + text: Icons.getNetworkMaterialSymbol() iconSize: Appearance.font.pixelSize.larger color: rightSidebarButton.colText } diff --git a/dots/.config/quickshell/ii/services/Network.qml b/dots/.config/quickshell/ii/services/Network.qml index 418258636..5e464cf99 100644 --- a/dots/.config/quickshell/ii/services/Network.qml +++ b/dots/.config/quickshell/ii/services/Network.qml @@ -34,24 +34,6 @@ Singleton { property string networkName: "" property int networkStrength - property string materialSymbol: root.ethernet - ? "lan" - : (root.wifiEnabled && root.wifiStatus === "connected") - ? ( - (root.active?.strength ?? 0) > 83 ? "signal_wifi_4_bar" : - (root.active?.strength ?? 0) > 67 ? "network_wifi" : - (root.active?.strength ?? 0) > 50 ? "network_wifi_3_bar" : - (root.active?.strength ?? 0) > 33 ? "network_wifi_2_bar" : - (root.active?.strength ?? 0) > 17 ? "network_wifi_1_bar" : - "signal_wifi_0_bar" - ) - : (root.wifiStatus === "connecting") - ? "signal_wifi_statusbar_not_connected" - : (root.wifiStatus === "disconnected") - ? "wifi_find" - : (root.wifiStatus === "disabled") - ? "signal_wifi_off" - : "signal_wifi_bad" // Control function enableWifi(enabled = true): void {