feat: show ethernet icon if ethernet is connected
Closes https://github.com/noctalia-dev/noctalia-shell/issues/115
This commit is contained in:
parent
8f951946ea
commit
cd102d894e
2 changed files with 22 additions and 1 deletions
|
|
@ -21,6 +21,7 @@ NIconButton {
|
||||||
colorBorderHover: Color.transparent
|
colorBorderHover: Color.transparent
|
||||||
|
|
||||||
icon: {
|
icon: {
|
||||||
|
if (NetworkService.ethernet) return "lan"
|
||||||
let connected = false
|
let connected = false
|
||||||
let signalStrength = 0
|
let signalStrength = 0
|
||||||
for (const net in NetworkService.networks) {
|
for (const net in NetworkService.networks) {
|
||||||
|
|
@ -30,7 +31,7 @@ NIconButton {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return connected ? NetworkService.signalIcon(signalStrength) : "wifi"
|
return connected ? NetworkService.signalIcon(signalStrength) : "wifi_find"
|
||||||
}
|
}
|
||||||
tooltipText: "WiFi Networks"
|
tooltipText: "WiFi Networks"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ Singleton {
|
||||||
property string detectedInterface: ""
|
property string detectedInterface: ""
|
||||||
property string lastConnectedNetwork: ""
|
property string lastConnectedNetwork: ""
|
||||||
property bool isLoading: false
|
property bool isLoading: false
|
||||||
|
property bool ethernet: false
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
Logger.log("Network", "Service started")
|
Logger.log("Network", "Service started")
|
||||||
|
|
@ -43,6 +44,7 @@ Singleton {
|
||||||
|
|
||||||
function refreshNetworks() {
|
function refreshNetworks() {
|
||||||
isLoading = true
|
isLoading = true
|
||||||
|
checkEthernet.running = true
|
||||||
existingNetwork.running = true
|
existingNetwork.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -416,6 +418,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 {
|
property Process addConnectionProcess: Process {
|
||||||
id: addConnectionProcess
|
id: addConnectionProcess
|
||||||
property string ifname: ""
|
property string ifname: ""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue