summaryrefslogtreecommitdiff
path: root/modules/bar/Workspaces.qml
blob: 73995c8b84dc3acd0496a6355794868c192fe3e1 (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
pragma ComponentBehavior: Bound

import "root:/widgets"
import "root:/services"
import "root:/config"
import Quickshell
import QtQuick
import QtQuick.Layouts

Item {
    property alias vertical: root.vertical

    implicitWidth: root.implicitWidth
    implicitHeight: root.implicitHeight

    Box {
        id: root

        readonly property color colour: Appearance.colours.mauve

        // homogenous: true

        Repeater {
            model: BarConfig.workspaces.shown

            Label {
                required property int index

                text: (index + 1).toString()
                color: root.colour
            }
        }

        // Text {
        //     Layout.alignment: Qt.AlignCenter
        //     horizontalAlignment: Text.AlignJustify

        //     text: root.vertical ? Time.format("hh\nmm") : Time.format("dd/MM/yy hh:mm")
        //     font.pointSize: Appearance.font.size.smaller
        //     font.family: Appearance.font.family.mono
        //     color: root.colour
        // }
    }

    Rectangle {
        x: (root.childrenRect.width / BarConfig.workspaces.shown) * ((Hyprland.activeWorkspace?.id ?? 1) - 1)
        y: 0
        width: root.childrenRect.width / BarConfig.workspaces.shown
        height: root.childrenRect.height
        color: "red"
        radius: 1000

        // layer.enabled: true
        // layer.effect: ShaderEffect {
        //     readonly property Item source: root
        //     fragmentShader: `
        //         varying highp vec2 qt_TexCoord0;
        //         uniform highp vec4 color;
        //         uniform sampler2D source;
        //         void main() {
        //             gl_FragColor = color * (1.0 - texture2D(source, qt_TexCoord0).w);
        //         }
        //     `
        // }
    }
}