summaryrefslogtreecommitdiff
path: root/.config/quickshell/Bar.qml
blob: b7ec963fe88b49e94895fdad44035a92a8230327 (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
214
215
216
217
218
import Quickshell
import Quickshell.Io
import QtQuick
import QtQuick.Layouts

Variants {
	model: Quickshell.screens;

	delegate: Component {
		PanelWindow {
			id: root

			required property var modelData
			screen: modelData

			property string fontFamily: "FiraCode Nerd Font"
			property int fontSize: 14

			anchors {
				top: true
				left: true
				right: true
			}

			implicitHeight: 36 + 8

			color: "transparent"

			Rectangle {
				anchors {
					fill: parent
					topMargin: 8
					leftMargin: 8
					rightMargin: 8
				}
				implicitHeight: 36
				color: "transparent"

				Rectangle {
					anchors.verticalCenter: parent.verticalCenter
					anchors.left: parent.left
					implicitWidth: tags.implicitWidth + 12*2
					height: parent.height
					color: Flexoki.bg
					radius: 18

					RowLayout {
						id: tags
						anchors.centerIn: parent
						implicitHeight: parent.implicitHeight
						spacing: 6

						Repeater {
							model: Tags.tags

							delegate: Rectangle {
								required property bool focused
								required property bool occupied

								width: 20
								height: 20
								radius: 10

								color: {
									if (focused) {
										if (occupied) {
											return Flexoki.re
										} else {
											return Flexoki.ui3
										}
									} else {
										return "transparent"
									}
								}

								border.width: 2
								border.color: occupied ? Flexoki.re : Flexoki.ui3
							}
						}
					}
				}

				RowLayout {
					anchors.centerIn: parent
					implicitHeight: parent.implicitHeight
					spacing: 4

					Rectangle {
						implicitWidth: song.implicitWidth + 16*2
						height: parent.height
						color: Flexoki.bg

						bottomLeftRadius: 18
						topLeftRadius: 18
						bottomRightRadius: 4
						topRightRadius: 4

						Text {
							id: song
							anchors.centerIn: parent
							text: Song.artist + " - " + Song.title
							color: Flexoki.tx
							font { family: root.fontFamily; pixelSize: root.fontSize }
						}
					}

					Rectangle {
						implicitWidth: cava.implicitWidth + 16*2
						height: parent.height
						color: Flexoki.bg

						bottomLeftRadius: 4
						topLeftRadius: 4
						bottomRightRadius: 18
						topRightRadius: 18

						Row {
							id: cava
							anchors.centerIn: parent
							height: 15 + 4
							spacing: 2

							Repeater {
								model: 8

								delegate: Rectangle {
									y: 15 - Cava.heights[index]
									width: 8
									height: Cava.heights[index] + 4
									radius: 4
									color: Flexoki.tx
								}
							}
						}
					}
				}

				Rectangle {
					anchors.verticalCenter: parent.verticalCenter
					anchors.right: parent.right
					implicitWidth: status.implicitWidth + 12*2
					height: parent.height
					color: Flexoki.bg
					radius: 18

					RowLayout {
						id: status
						anchors.centerIn: parent
						implicitHeight: parent.implicitHeight
						spacing: 24

						Text {
							text: {
								//     
								var icon
								if (Volume.volume == 0) {
									icon = " "
								} else if (Volume.volume < 50) {
									icon = " "
								} else {
									icon = "  "
								}
								return icon + Volume.volume + "%"
							}
							color: Flexoki.re
							font { family: root.fontFamily; pixelSize: root.fontSize }
						}

						Text {
							text: Wifi.ssid == "" ? "󰖪 " : "󰖩 " + Wifi.ssid
							color: Flexoki.or
							font { family: root.fontFamily; pixelSize: root.fontSize }
						}

						Text {
							text: " " + Brightness.brightness + "%"
							color: Flexoki.ye
							font { family: root.fontFamily; pixelSize: root.fontSize }
						}

						Text {
							text: {
								var icon
								var i = Math.round((Battery.capacity - 1) / 10)
								switch (Battery.status) {
									case "Full":
										icon = "󰂄"
										break
									case "Discharging":
										icon = ["󰁺","󰁻","󰁼","󰁽","󰁾","󰁿","󰂀","󰂁","󰂂","󰁹"][i]
										break
									case "Charging":
										icon = ["󰢜","󰂆","󰂇","󰂈","󰢝","󰂉","󰢞","󰂊","󰂋","󰂅"][i]
										break
								}
							  return icon + " " + Battery.capacity + "%"
							}
							color: Flexoki.gr
							font { family: root.fontFamily; pixelSize: root.fontSize }
						}

						Text {
							text: " " + Time.time
							color: Flexoki.bl
							font { family: root.fontFamily; pixelSize: root.fontSize }
						}

						Text {
							text: "󰐥"
							color: Flexoki.pu
							font { family: root.fontFamily; pixelSize: root.fontSize * 1.5 }
						}
					}
				}
			}
		}
	}
}