Merge pull request #134 from ThatOneCalculator/feat/ethernet

feat: show ethernet icon if ethernet is connected
This commit is contained in:
Lemmy 2025-08-22 16:53:19 -04:00 committed by GitHub
commit f15563fbad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 2 deletions

View file

@ -16,6 +16,7 @@ Singleton {
property string detectedInterface: ""
property string lastConnectedNetwork: ""
property bool isLoading: false
property bool ethernet: false
Component.onCompleted: {
Logger.log("Network", "Service started")
@ -43,6 +44,7 @@ Singleton {
function refreshNetworks() {
isLoading = true
checkEthernet.running = true
existingNetwork.running = true
}
@ -415,6 +417,24 @@ Singleton {
}
}
}
property Process checkEthernet: Process {
id: checkEthernet
running: false
command: ["nmcli", "-t", "-f", "DEVICE,TYPE,STATE", "device"]
stdout: StdioCollector {
onStreamFinished: {
var lines = text.split("\n")
for (var i = 0; i < lines.length; ++i) {
var parts = lines[i].split(":")
if (parts[1] === "ethernet" && parts[2] === "connected") {
root.ethernet = true
break
}
}
}
}
}
property Process addConnectionProcess: Process {
id: addConnectionProcess