Network: support for ethernet-off icon even tho the logic is not in yet.

This commit is contained in:
ItsLemmy
2025-11-13 10:26:51 -05:00
parent 889bbfcb4f
commit 3d81d445a3
5 changed files with 14 additions and 17 deletions
+1 -1
View File
@@ -322,4 +322,4 @@
"battery": {
"chargingMode": 0
}
}
}
+1
View File
@@ -42,6 +42,7 @@ Singleton {
"powersaver": "leaf",
"storage": "database",
"ethernet": "sitemap",
"ethernet-off": "sitemap-off",
"keyboard": "keyboard",
"shutdown": "power",
"lock": "lock",
+2 -2
View File
@@ -41,7 +41,7 @@ Item {
icon: {
try {
if (NetworkService.ethernetConnected) {
return "ethernet"
return NetworkService.internetConnectivity ? "ethernet" : "ethernet-off"
}
let connected = false
let signalStrength = 0
@@ -55,7 +55,7 @@ Item {
return connected ? NetworkService.signalIcon(signalStrength, true) : "wifi-off"
} catch (error) {
Logger.e("Wi-Fi", "Error getting icon:", error)
return "signal_wifi_bad"
return "wifi-off"
}
}
text: {
@@ -11,7 +11,7 @@ NIconButtonHot {
icon: {
try {
if (NetworkService.ethernetConnected) {
return "ethernet"
return NetworkService.internetConnectivity ? "ethernet" : "ethernet-off"
}
let connected = false
let signalStrength = 0
@@ -25,7 +25,7 @@ NIconButtonHot {
return connected ? NetworkService.signalIcon(signalStrength, true) : "wifi-off"
} catch (error) {
Logger.e("Wi-Fi", "Error getting icon:", error)
return "signal_wifi_bad"
return "wifi-off"
}
}
+8 -12
View File
@@ -304,29 +304,29 @@ Singleton {
id: connectivityCheckProcess
running: false
command: ["nmcli", "networking", "connectivity", "check"]
property int failedChecks: 0
stdout: StdioCollector {
onStreamFinished: {
const result = text.trim()
if (!result) {
return
}
if (result === "none" && root.networkConnectivity !== result) {
root.networkConnectivity = result
connectivityCheckProcess.failedChecks = 0
root.scan()
}
if (result === "full" && root.networkConnectivity !== result) {
root.networkConnectivity = result
root.internetConnectivity = true
connectivityCheckProcess.failedChecks = 0
root.scan()
}
if ((result === "limited" || result === "portal") && root.networkConnectivity !== result) {
connectivityCheckProcess.failedChecks++
if (connectivityCheckProcess.failedChecks === 3) {
@@ -334,7 +334,7 @@ Singleton {
pingCheckProcess.running = true
}
}
if (result === "unknown" && root.networkConnectivity !== result) {
root.networkConnectivity = result
connectivityCheckProcess.failedChecks = 0
@@ -350,14 +350,10 @@ Singleton {
}
}
}
Process {
id: pingCheckProcess
command: ["sh", "-c",
"ping -c1 -W2 ping.archlinux.org >/dev/null 2>&1 || " +
"ping -c1 -W2 1.1.1.1 >/dev/null 2>&1 || " +
"curl -fsI --max-time 5 https://cloudflare.com/cdn-cgi/trace >/dev/null 2>&1"
]
command: ["sh", "-c", "ping -c1 -W2 ping.archlinux.org >/dev/null 2>&1 || " + "ping -c1 -W2 1.1.1.1 >/dev/null 2>&1 || " + "curl -fsI --max-time 5 https://cloudflare.com/cdn-cgi/trace >/dev/null 2>&1"]
onExited: (exitCode, exitStatus) => {
if (exitCode === 0) {