consistent wifi display (looks good)
This commit is contained in:
@@ -12,6 +12,7 @@ Container {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property HyprlandMonitor monitor
|
required property HyprlandMonitor monitor
|
||||||
|
property double networkDisplayHeight: 80
|
||||||
property bool opened: false
|
property bool opened: false
|
||||||
|
|
||||||
animOffset: 250
|
animOffset: 250
|
||||||
@@ -48,7 +49,7 @@ Container {
|
|||||||
when: root.opened == true && root.hovered == true
|
when: root.opened == true && root.hovered == true
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
root.boxHeight: 28
|
root.boxHeight: root.networkDisplayHeight
|
||||||
root.boxRadius: 12
|
root.boxRadius: 12
|
||||||
root.boxWidth: 350
|
root.boxWidth: 350
|
||||||
}
|
}
|
||||||
@@ -87,11 +88,74 @@ Container {
|
|||||||
Component {
|
Component {
|
||||||
id: wifiInfo
|
id: wifiInfo
|
||||||
|
|
||||||
StyledText {
|
Item {
|
||||||
horizontalAlignment: Qt.AlignCenter
|
id: networkDisplayRoot
|
||||||
|
|
||||||
|
property double innerMargin: 5
|
||||||
|
property double outerMargin: 6
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: networkDisplayBg
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: networkDisplayRoot.outerMargin
|
||||||
|
color: Colors.surface1
|
||||||
|
radius: 8
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: iconBox
|
||||||
|
|
||||||
|
property double iconBoxRadius: 5
|
||||||
|
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.margins: networkDisplayRoot.innerMargin
|
||||||
|
color: Colors.red
|
||||||
|
implicitWidth: root.networkDisplayHeight - (networkDisplayRoot.innerMargin * 2) - (
|
||||||
|
networkDisplayRoot.outerMargin * 2)
|
||||||
|
radius: 5
|
||||||
|
|
||||||
|
CenteredText {
|
||||||
|
fontSize: 23
|
||||||
propo: true
|
propo: true
|
||||||
text: NetworkManager.getWifiText()
|
text: NetworkManager.getNetworkDetails(NetworkManager.defaultAdapter)["icon"]
|
||||||
verticalAlignment: Qt.AlignVCenter
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: networkColumn
|
||||||
|
|
||||||
|
property var networkInfo: NetworkManager.getNetworkDetails(NetworkManager.defaultAdapter)
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
color: Colors.text
|
||||||
|
fontSize: 14
|
||||||
|
text: networkColumn.networkInfo["networkName"]
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
color: Colors.subtext1
|
||||||
|
fontSize: 12
|
||||||
|
fontWeight: 5
|
||||||
|
text: "Connected on: " + networkColumn.networkInfo["adapterName"]
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
property var timeInfo: networkColumn.networkInfo["time"]
|
||||||
|
|
||||||
|
color: Colors.subtext1
|
||||||
|
fontSize: 12
|
||||||
|
fontWeight: 5
|
||||||
|
text: "Network Details " + (networkColumn.networkInfo["saved"] == true ? "Saved" : "Not Saved")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,9 @@ import Quickshell.Networking
|
|||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property NetworkDevice defaultAdapter: Networking.devices.values[0]
|
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]
|
||||||
|
|
||||||
function getConnectedNetworks(networksArr) {
|
function getConnectedNetworks(networksArr) {
|
||||||
let connectedNetworks = [];
|
let connectedNetworks = [];
|
||||||
@@ -52,7 +50,8 @@ Singleton {
|
|||||||
"adapterIsWifi": deviceWifi,
|
"adapterIsWifi": deviceWifi,
|
||||||
"networkName": networkName,
|
"networkName": networkName,
|
||||||
"networkStrength": networkStrength,
|
"networkStrength": networkStrength,
|
||||||
"icon": networkIcon
|
"icon": networkIcon,
|
||||||
|
"saved": primaryNetwork.known
|
||||||
};
|
};
|
||||||
return outputDict;
|
return outputDict;
|
||||||
}
|
}
|
||||||
@@ -63,10 +62,6 @@ Singleton {
|
|||||||
return iconArr[strengthIndex - 1];
|
return iconArr[strengthIndex - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
function isConnectedAndWifi() {
|
|
||||||
return root.connectedWifi;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getWifiText() {
|
function getWifiText() {
|
||||||
let info = getNetworkDetails(defaultAdapter);
|
let info = getNetworkDetails(defaultAdapter);
|
||||||
|
|
||||||
@@ -77,6 +72,10 @@ Singleton {
|
|||||||
return finalString;
|
return finalString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isConnectedAndWifi() {
|
||||||
|
return root.connectedWifi;
|
||||||
|
}
|
||||||
|
|
||||||
function isDeviceWifi(adapter) {
|
function isDeviceWifi(adapter) {
|
||||||
if (adapter.type == DeviceType.Wifi) {
|
if (adapter.type == DeviceType.Wifi) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user