mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-05-27 08:12:28 +00:00
Network: support for ethernet-off icon even tho the logic is not in yet.
This commit is contained in:
@@ -322,4 +322,4 @@
|
||||
"battery": {
|
||||
"chargingMode": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,7 @@ Singleton {
|
||||
"powersaver": "leaf",
|
||||
"storage": "database",
|
||||
"ethernet": "sitemap",
|
||||
"ethernet-off": "sitemap-off",
|
||||
"keyboard": "keyboard",
|
||||
"shutdown": "power",
|
||||
"lock": "lock",
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user