summaryrefslogtreecommitdiff
path: root/.config/quickshell/Modules/BarWorkspaces.qml
blob: 36ebf77e566ac2a36e98ebf41ed211d1b42d7c51 (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
import Quickshell
import Quickshell.Hyprland
import QtQuick
import qs.Services

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

	Row {
		id: workspaces
		anchors.centerIn: parent
		height: 20
		spacing: 6

		Repeater {
			model: 10

			delegate: Rectangle {
				property HyprlandWorkspace ws: {
					Hyprland.workspaces.values.find(ws => (
						ws.monitor && ws.monitor.name === root.screen.name && ws.id % 10 === index + 1
					)) || null
				}
				property bool focused: {
					ws && ws.focused
				}
				property bool occupied: {
					ws && ws.toplevels.values.length > 0
				}

				width: 20
				height: 20
				radius: 10

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

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