summaryrefslogtreecommitdiff
path: root/modules/bar/Pills.qml
blob: 042e9c10856465266d6e1ea2edaf046de4bddfe6 (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
pragma ComponentBehavior: Bound

import "root:/widgets"
import "root:/config"
import "components"
import "components/workspaces"
import Quickshell.Wayland
import QtQuick

Item {
    Item {
        id: root

        function get(horiz, vert) {
            return BarConfig.vertical ? vert : horiz;
        }

        anchors.fill: parent
        anchors.leftMargin: get(BarConfig.sizes.floatingGapLarge, BarConfig.sizes.floatingGap)
        anchors.topMargin: get(BarConfig.sizes.floatingGap, BarConfig.sizes.floatingGapLarge)
        anchors.rightMargin: get(BarConfig.sizes.floatingGapLarge, 0)
        anchors.bottomMargin: get(0, BarConfig.sizes.floatingGapLarge)

        Pill {
            anchors.left: parent.left

            OsIcon {
                id: osIcon

                anchors.horizontalCenter: root.get(undefined, parent.horizontalCenter)
                anchors.verticalCenter: root.get(parent.verticalCenter, undefined)
            }

            Workspaces {
                vertical: BarConfig.vertical

                anchors.left: root.get(osIcon.right, undefined)
                anchors.leftMargin: root.get(Appearance.padding.large, 0)
                anchors.top: root.get(undefined, osIcon.bottom)
                anchors.topMargin: root.get(0, Appearance.padding.large)

                anchors.horizontalCenter: root.get(undefined, parent.horizontalCenter)
                anchors.verticalCenter: root.get(parent.verticalCenter, undefined)
            }
        }

        Pill {
            anchors.horizontalCenter: root.get(parent.horizontalCenter, undefined)
            anchors.verticalCenter: root.get(undefined, parent.verticalCenter)

            ActiveWindow {
                vertical: BarConfig.vertical

                anchors.horizontalCenter: root.get(undefined, parent.horizontalCenter)
                anchors.verticalCenter: root.get(parent.verticalCenter, undefined)
            }
        }

        Pill {
            anchors.right: parent.right

            Clock {
                id: clock

                vertical: BarConfig.vertical

                anchors.horizontalCenter: root.get(undefined, parent.horizontalCenter)
                anchors.verticalCenter: root.get(parent.verticalCenter, undefined)
            }

            StatusIcons {
                anchors.left: root.get(clock.right, undefined)
                anchors.leftMargin: root.get(Appearance.padding.large, 0)
                anchors.top: root.get(undefined, clock.bottom)
                anchors.topMargin: root.get(0, Appearance.padding.large)

                anchors.horizontalCenter: root.get(undefined, parent.horizontalCenter)
                anchors.verticalCenter: root.get(parent.verticalCenter, undefined)
            }
        }
    }

    component Pill: PaddedRect {
        id: pill

        color: Appearance.alpha(Appearance.colours.base, false)
        radius: Appearance.rounding.full
        padding: BarConfig.vertical ? [Appearance.padding.large, 0] : [0, Appearance.padding.large]

        width: BarConfig.vertical ? BarConfig.sizes.height : implicitWidth
        height: BarConfig.vertical ? implicitHeight : BarConfig.sizes.height
    }
}