summaryrefslogtreecommitdiff
path: root/modules/launcher/Content.qml
blob: 2f9fcdd81fbf6d371a00b271893b79b24c9c11fb (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
import "root:/widgets"
import "root:/config"
import Quickshell
import QtQuick

Item {
    implicitWidth: LauncherConfig.sizes.width
    implicitHeight: search.height + list.height + Appearance.padding.large * 5 // Don't question it
    anchors.horizontalCenter: parent.horizontalCenter

    StyledRect {
        color: Appearance.alpha(Appearance.colours.m3surfaceContainerHigh, true)
        radius: Appearance.rounding.large
        implicitHeight: list.height + Appearance.padding.large * 2

        anchors.left: parent.left
        anchors.right: parent.right
        anchors.bottom: search.top
        anchors.bottomMargin: Appearance.spacing.normal
        anchors.margins: Appearance.padding.large

        ListView {
            id: list

            model: DesktopEntries.applications.values.filter(x => x.name.toLowerCase().includes(search.text.toLowerCase()))

            orientation: Qt.Vertical
            verticalLayoutDirection: Qt.BottomToTop
            height: 100
            width: 100

            anchors.left: parent.left
            anchors.right: parent.right
            anchors.bottom: parent.bottom
            anchors.margins: Appearance.padding.large

            delegate: PaddedRect {
                id: entry

                required property DesktopEntry modelData

                width: LauncherConfig.sizes.width

                StyledText {
                    text: modelData.name
                    font.family: Appearance.font.family.sans
                    font.pointSize: Appearance.font.size.smaller
                }
            }
        }
    }

    StyledTextField {
        id: search

        anchors.left: parent.left
        anchors.right: parent.right
        anchors.bottom: parent.bottom
        anchors.margins: Appearance.padding.large

        placeholderText: "Type \">\" for commands"

        background: StyledRect {
            color: Appearance.alpha(Appearance.colours.m3surfaceContainerHigh, true)
            radius: Appearance.rounding.large
        }
    }
}