forked from Shinonome/dots-hyprland
move material symbol in Network service to Icon
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user