added private ip on network view
This commit is contained in:
@@ -142,7 +142,8 @@ Container {
|
|||||||
color: Colors.subtext1
|
color: Colors.subtext1
|
||||||
fontSize: 12
|
fontSize: 12
|
||||||
fontWeight: 5
|
fontWeight: 5
|
||||||
text: "Connected on: " + networkColumn.networkInfo["adapterName"]
|
text: networkColumn.networkInfo["ipAddress"] + " on "
|
||||||
|
+ networkColumn.networkInfo["adapterName"]
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
import Quickshell.Networking
|
import Quickshell.Networking
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
@@ -9,6 +10,7 @@ Singleton {
|
|||||||
property bool connectedWifi: root.defaultAdapter != null && root.defaultAdapter.connected
|
property bool connectedWifi: root.defaultAdapter != null && root.defaultAdapter.connected
|
||||||
&& root.defaultAdapter.type == DeviceType.Wifi
|
&& root.defaultAdapter.type == DeviceType.Wifi
|
||||||
property NetworkDevice defaultAdapter: Networking.devices.values[0] || null
|
property NetworkDevice defaultAdapter: Networking.devices.values[0] || null
|
||||||
|
property string ipAddress: "0.0.0.0"
|
||||||
|
|
||||||
function getConnectedNetworks(networksArr) {
|
function getConnectedNetworks(networksArr) {
|
||||||
let connectedNetworks = [];
|
let connectedNetworks = [];
|
||||||
@@ -61,7 +63,8 @@ Singleton {
|
|||||||
"networkName": networkName,
|
"networkName": networkName,
|
||||||
"networkStrength": networkStrength,
|
"networkStrength": networkStrength,
|
||||||
"icon": networkIcon,
|
"icon": networkIcon,
|
||||||
"saved": primaryNetwork.known
|
"saved": primaryNetwork.known,
|
||||||
|
"ipAddress": root.ipAddress
|
||||||
};
|
};
|
||||||
return outputDict;
|
return outputDict;
|
||||||
}
|
}
|
||||||
@@ -96,4 +99,24 @@ Singleton {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function refreshIpAddress() {
|
||||||
|
ipProcess.running = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
onDefaultAdapterChanged: {
|
||||||
|
refreshIpAddress();
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: ipProcess
|
||||||
|
|
||||||
|
command: ["sh", "-c", "ip -4 -o addr show dev " + root.defaultAdapter.name
|
||||||
|
+ " scope global | awk '{sub(\"/.*\", \"\", $4); printf $4}'"]
|
||||||
|
running: true
|
||||||
|
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: root.ipAddress = this.text
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user