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

PaddedRect {
    id: root

    required property DesktopEntry modelData

    implicitWidth: ListView.view.width
    padding: [Appearance.padding.smaller, Appearance.padding.normal]
    radius: Appearance.rounding.normal
    // color: ListView.isCurrentItem ? Appearance.alpha(Appearance.colours.m3surfaceContainerHighest, true) : "transparent"

    IconImage {
        id: icon

        source: Quickshell.iconPath(root.modelData.icon)
        implicitSize: parent.height * 0.8

        anchors.verticalCenter: parent.verticalCenter
    }

    Item {
        anchors.left: icon.right
        anchors.leftMargin: Appearance.spacing.normal
        anchors.verticalCenter: icon.verticalCenter

        implicitWidth: parent.width - icon.width
        implicitHeight: childrenRect.height

        StyledText {
            id: name

            text: root.modelData.name
            font.pointSize: Appearance.font.size.normal
        }

        StyledText {
            text: qsTr(root.modelData.comment || root.modelData.genericName || root.modelData.name)
            font.pointSize: Appearance.font.size.small
            color: Appearance.alpha(Appearance.colours.m3outline, true)

            elide: Text.ElideRight
            width: root.width - icon.width - Appearance.rounding.normal * 2

            anchors.top: name.bottom
        }
    }
}