blob: 70a633c14e94148aaa0fc333a60278e157324c82 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
import QtQuick
import Quickshell
import QtQuick.Layouts
import qs.components
import qs.config
Scope {
id: root
Variants {
model: Quickshell.screens
IWindow {
id: barWindow
name: "quickshell::bar"
anchors {
top: true
left: true
right: true
}
implicitHeight: child.implicitHeight + Bar.topMargin * 2
IRect {
id: child
radius: Bar.borderRadius
implicitHeight: Bar.height
implicitWidth: parent.width
anchors {
left: parent.left
right: parent.mid
fill: parent
top: parent.top
topMargin: Bar.topMargin
leftMargin: Bar.leftMargin
rightMargin: Bar.rightMargin
}
color: "transparent"
IRect {
id: leftRow
anchors {
left: parent.left
}
width: leftInnerRow.width + leftInnerRow.anchors.leftMargin - leftSpacer.width
height: leftInnerRow.height
color: Qt.rgba(Colors.background3.r, Colors.background3.g, Colors.background3.b, Bar.bgTransparency)
radius: Bar.moduleRadius
Behavior on color {
ColorAnimation {
duration: General.animationDuration
easing.type: Easing.InOutQuad
}
}
RowLayout {
id: leftInnerRow
height: child.height
spacing: Bar.leftModuleSpacing
anchors {
left: parent.left
leftMargin: Bar.moduleLeftMargin
}
Workspace {
id: workspace
// screen: barWindow.screen // multi monitor
// Layout.minimumWidth: 400 // FIXME
}
Mpris {
id: mpris
}
Item {
id: leftSpacer
Layout.fillWidth: true
Layout.fillHeight: true
}
}
}
Item {
id: centerRow
anchors.centerIn: parent
ActiveWindow {
id: activeWindow
width: Math.min(implicitWidth, child.width - Math.max(leftRow.width, rightRow.width) * 2 - Bar.leftMargin - Bar.rightMargin) // we don't do child.width - leftRow.width - rightRow.width because left and right width isn't symetric, and we're centered meaning we will colide into the larger width side
}
}
IRect {
id: rightRow
anchors.right: parent.right
width: rightInnerRow.width + rightInnerRow.anchors.rightMargin - rightSpacer.width
height: rightInnerRow.height
color: Qt.rgba(Colors.background3.r, Colors.background3.g, Colors.background3.b, Bar.bgTransparency)
radius: Bar.moduleRadius
RowLayout {
id: rightInnerRow
anchors {
right: parent.right
rightMargin: Bar.moduleRightMargin
}
layoutDirection: Qt.RightToLeft
height: child.height
spacing: Bar.rightModuleSpacing
Power {
id: power
}
// Tray {
// id: tray
// }
Item {
Layout.preferredWidth: timeDateCCWrapper.implicitWidth
Layout.preferredHeight: timeDateCCWrapper.implicitHeight
IRect {
id: timeDateCCWrapper
color: Colors.accent
radius: Style.rounding.large
anchors.fill: parent
implicitHeight: Bar.height - General.rectMargin
implicitWidth: timeDateCC.width + General.rectMargin * 2
RowLayout {
id: timeDateCC
property bool showcc: false
// width: childrenRect.width
// height: childrenRect.height
anchors.centerIn: parent
TimeDate {}
Item {
implicitWidth: timeDateCC.showcc ? ccLoader.width : 0
implicitHeight: timeDateCC.showcc ? ccLoader.height : 0
Loader {
id: ccLoader
active: timeDateCC.showcc
sourceComponent: Component {
Icon {
text: ""
SequentialAnimation {
running: true
NumberAnimation {
target: parent
property: "opacity"
from: 0
to: 1
duration: General.animationDuration / 2
easing.type: Easing.InOutQuad
}
}
}
}
}
Behavior on implicitWidth {
NumberAnimation {
duration: General.animationDuration / 4
easing.type: Easing.InOutQuad
}
}
}
}
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
onEntered: {
timeDateCC.showcc = true;
}
onExited: {
timeDateCC.showcc = false;
}
}
}
Network {}
// Temp {
// id: temp
// }
// Gpu {
// id: gpu
// }
// Memory {
// id: memory
// }
// Cpu {
// id: cpu
// }
Resources {}
Item {
id: rightSpacer
Layout.fillWidth: true
Layout.fillHeight: true
}
}
Behavior on color {
ColorAnimation {
duration: General.animationDuration
easing.type: Easing.InOutQuad
}
}
}
}
}
}
}
|