quickshell-toki-night/modules/launcher/items/AppItem.qml

80 lines
2 KiB
QML

import "../services"
import qs.config
import qs.custom
import qs.services
import qs.util
import Quickshell
import Quickshell.Widgets
import QtQuick
Item {
id: root
required property DesktopEntry modelData
required property PersistentProperties uiState
implicitHeight: Config.launcher.itemHeight
anchors.left: parent?.left
anchors.right: parent?.right
StateLayer {
radius: 1000
anchors.fill: parent
function onClicked(): void {
Apps.launch(root.modelData);
root.uiState.launcher = false;
}
}
Item {
anchors.fill: parent
anchors.leftMargin: 12
anchors.rightMargin: 12
anchors.margins: 7
IconImage {
id: icon
source: Quickshell.iconPath(root.modelData?.icon, "image-missing")
implicitSize: parent.height * 0.9
anchors.verticalCenter: parent.verticalCenter
}
Item {
anchors.left: icon.right
anchors.leftMargin: 12
anchors.verticalCenter: icon.verticalCenter
implicitWidth: parent.width - icon.width
implicitHeight: name.implicitHeight + comment.implicitHeight
CustomText {
id: name
text: root.modelData?.name ?? ""
font.pointSize: Config.font.size.normal
color: root.ListView.isCurrentItem ? Color.mute(Config.colors.launcherApps) : Config.colors.primary
Behavior on color {
CAnim {}
}
}
CustomText {
id: comment
text: (root.modelData?.comment || root.modelData?.genericName || root.modelData?.name) ?? ""
font.pointSize: Config.font.size.small
color: Config.colors.tertiary
elide: Text.ElideRight
width: root.width - icon.width - 34
anchors.top: name.bottom
}
}
}
}