diff --git a/Bar/Network.qml b/Bar/Network.qml index dfce4f8..8435dc1 100644 --- a/Bar/Network.qml +++ b/Bar/Network.qml @@ -12,6 +12,7 @@ Container { id: root required property HyprlandMonitor monitor + property double networkDisplayHeight: 80 property bool opened: false animOffset: 250 @@ -48,7 +49,7 @@ Container { when: root.opened == true && root.hovered == true PropertyChanges { - root.boxHeight: 28 + root.boxHeight: root.networkDisplayHeight root.boxRadius: 12 root.boxWidth: 350 } @@ -87,11 +88,74 @@ Container { Component { id: wifiInfo - StyledText { - horizontalAlignment: Qt.AlignCenter - propo: true - text: NetworkManager.getWifiText() - verticalAlignment: Qt.AlignVCenter + Item { + 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 + text: NetworkManager.getNetworkDetails(NetworkManager.defaultAdapter)["icon"] + } + } + + 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") + } + } + } + } } } } diff --git a/Services/NetworkManager.qml b/Services/NetworkManager.qml index 24d4fd1..13e3698 100644 --- a/Services/NetworkManager.qml +++ b/Services/NetworkManager.qml @@ -6,12 +6,10 @@ import Quickshell.Networking Singleton { id: root + property bool connectedWifi: root.defaultAdapter != null && root.defaultAdapter.connected + && root.defaultAdapter.type == DeviceType.Wifi property NetworkDevice defaultAdapter: Networking.devices.values[0] - property bool connectedWifi: root.defaultAdapter != null - && root.defaultAdapter.connected - && root.defaultAdapter.type == DeviceType.Wifi - function getConnectedNetworks(networksArr) { let connectedNetworks = []; @@ -52,7 +50,8 @@ Singleton { "adapterIsWifi": deviceWifi, "networkName": networkName, "networkStrength": networkStrength, - "icon": networkIcon + "icon": networkIcon, + "saved": primaryNetwork.known }; return outputDict; } @@ -63,10 +62,6 @@ Singleton { return iconArr[strengthIndex - 1]; } - function isConnectedAndWifi() { - return root.connectedWifi; - } - function getWifiText() { let info = getNetworkDetails(defaultAdapter); @@ -77,6 +72,10 @@ Singleton { return finalString; } + function isConnectedAndWifi() { + return root.connectedWifi; + } + function isDeviceWifi(adapter) { if (adapter.type == DeviceType.Wifi) { return true;