109 lines
2.4 KiB
QML
109 lines
2.4 KiB
QML
import Quickshell
|
|
import Quickshell.Widgets
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import ZShell.Config
|
|
import ZShell.Components
|
|
import ZShell
|
|
import qs.Modules.Launcher.Services
|
|
import qs.Components
|
|
import qs.Helpers
|
|
import qs.Modules
|
|
import qs.Services
|
|
|
|
Item {
|
|
id: root
|
|
|
|
required property DesktopEntry modelData
|
|
required property ScreenState screenState
|
|
|
|
anchors.left: parent?.left
|
|
anchors.right: parent?.right
|
|
implicitHeight: ZUtils.snap(Tokens.sizes.launcher.itemHeight, root)
|
|
|
|
StateLayer {
|
|
radius: Tokens.rounding.medium
|
|
|
|
onClicked: {
|
|
// Apps.launch(root.modelData);
|
|
// root.screenState.launcher = false;
|
|
|
|
ZUtils.logPlacement(icon, "icon");
|
|
ZUtils.logPlacement(name, "name");
|
|
ZUtils.logPlacement(favoriteIcon, "favoriteIcon");
|
|
ZUtils.logPlacement(comment, "comment");
|
|
ZUtils.logPlacement(text, "text");
|
|
ZUtils.logPlacement(mainLayout, "main");
|
|
}
|
|
}
|
|
|
|
SnapLayout {
|
|
id: mainLayout
|
|
anchors.fill: parent
|
|
anchors.leftMargin: Tokens.padding.medium
|
|
anchors.rightMargin: Tokens.padding.medium
|
|
spacing: Tokens.spacing.medium
|
|
|
|
IconImage {
|
|
id: icon
|
|
|
|
implicitSize: parent.height - Tokens.padding.small * 2
|
|
source: Quickshell.iconPath(root.modelData?.icon, "image-missing")
|
|
}
|
|
|
|
SnapLayout {
|
|
id: text
|
|
|
|
Layout.fillHeight: true
|
|
Layout.fillWidth: true
|
|
Layout.topMargin: Tokens.padding.extraSmall
|
|
Layout.bottomMargin: Tokens.padding.extraSmall
|
|
|
|
orientation: Qt.Vertical
|
|
spacing: 0
|
|
|
|
CustomText {
|
|
id: name
|
|
|
|
Layout.fillHeight: true
|
|
Layout.fillWidth: true
|
|
|
|
text: root.modelData?.name ?? ""
|
|
verticalAlignment: CustomText.AlignVCenter
|
|
horizontalAlignment: CustomText.AlignLeft
|
|
}
|
|
|
|
CustomText {
|
|
id: comment
|
|
|
|
Layout.fillHeight: true
|
|
Layout.fillWidth: true
|
|
|
|
color: Colors.palette.m3outline
|
|
elide: Text.ElideRight
|
|
font: Tokens.font.body.small
|
|
text: (root.modelData?.comment || root.modelData?.genericName || root.modelData?.name) ?? ""
|
|
verticalAlignment: CustomText.AlignVCenter
|
|
horizontalAlignment: CustomText.AlignLeft
|
|
}
|
|
}
|
|
|
|
Loader {
|
|
id: favoriteIcon
|
|
|
|
active: root.modelData && Strings.testRegexList(Config.launcher.favoriteApps, root.modelData.id)
|
|
Layout.fillHeight: true
|
|
|
|
asynchronous: true
|
|
|
|
sourceComponent: MaterialIcon {
|
|
color: Colors.palette.m3primary
|
|
fill: 1
|
|
text: "favorite"
|
|
|
|
verticalAlignment: MaterialIcon.AlignVCenter
|
|
}
|
|
}
|
|
}
|
|
}
|