me like nix
1import QtQuick
2import QtQuick.Layouts
3import Quickshell
4import Quickshell.Wayland
5import "../../../config" as Config
6import "../../../components"
7import "../../../services" as Services
8
9PopupWindow {
10 id: networkPopout
11
12 property bool show: false
13 property var parentWindow
14 property real anchorY: 0
15 signal close()
16
17 visible: show || contentRect.opacity > 0
18 anchor.window: parentWindow
19 anchor.onAnchoring: {
20 anchor.rect.x = parentWindow.width + 8
21 anchor.rect.y = Math.max(0, anchorY - implicitHeight / 2)
22 }
23
24 implicitWidth: 220
25 implicitHeight: netContent.implicitHeight + 32
26 color: "transparent"
27
28 onShowChanged: {
29 if (show) { contentRect._opening = true; fadeIn.start() }
30 else { fadeIn.stop(); contentRect._opening = false; contentRect.opacity = 0 }
31 }
32 Timer { id: fadeIn; interval: 16; onTriggered: contentRect.opacity = 1 }
33
34 Rectangle {
35 id: contentRect
36 anchors.fill: parent
37 color: Config.Colours.base
38 radius: Config.Appearance.rounding.large
39 border.width: 1
40 border.color: Config.Colours.surface0
41 opacity: 0
42 property bool _opening: false
43 Behavior on opacity {
44 Anim {
45 duration: contentRect._opening ? Config.Appearance.anim.durations.normal : Config.Appearance.anim.durations.small
46 easing.bezierCurve: contentRect._opening ? Config.Appearance.anim.curves.standardDecel : Config.Appearance.anim.curves.standardAccel
47 }
48 }
49
50 ColumnLayout {
51 id: netContent
52 anchors.fill: parent
53 anchors.margins: 16
54 spacing: 12
55
56 Text {
57 color: Config.Colours.text
58 font.family: Config.Appearance.font.family
59 font.pixelSize: Config.Appearance.font.size.normal
60 font.bold: true
61 text: "Network"
62 }
63
64 RowLayout {
65 Layout.fillWidth: true
66 spacing: 8
67
68 Text {
69 color: Config.Colours.green
70 font.family: Config.Appearance.font.family
71 font.pixelSize: 20
72 text: {
73 if (!Services.Network.connected) return "\uf071"
74 if (Services.Network.isEthernet) return "\udb80\ude00"
75 return "\uf1eb"
76 }
77 }
78
79 ColumnLayout {
80 spacing: 2
81 Text { color: Config.Colours.text; font.family: Config.Appearance.font.family; font.pixelSize: Config.Appearance.font.size.normal; text: Services.Network.connected ? Services.Network.name : "Disconnected" }
82 Text { color: Config.Colours.subtext0; font.family: Config.Appearance.font.family; font.pixelSize: Config.Appearance.font.size.small; text: { if (!Services.Network.connected) return "No connection"; if (Services.Network.isEthernet) return "Wired connection"; return "Signal: " + Services.Network.strength + "%" } }
83 }
84 }
85 }
86
87 Keys.onEscapePressed: networkPopout.close()
88 }
89
90 MouseArea { anchors.fill: parent; z: -1; onClicked: networkPopout.close() }
91}