summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-02 22:23:15 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-02 22:23:15 +1000
commit1ec02cb54e3083e726a5e4b745aa46527fa5a496 (patch)
treee7ba3638ebf78af816d393ab3b456ab1d8981481
parentcontrols: use basic style (diff)
downloadcaelestia-shell-1ec02cb54e3083e726a5e4b745aa46527fa5a496.tar.gz
caelestia-shell-1ec02cb54e3083e726a5e4b745aa46527fa5a496.tar.bz2
caelestia-shell-1ec02cb54e3083e726a5e4b745aa46527fa5a496.zip
launcher: list item interactivity
-rw-r--r--modules/launcher/AppItem.qml13
-rw-r--r--modules/launcher/Content.qml4
-rw-r--r--services/Apps.qml5
-rw-r--r--widgets/StateLayer.qml45
4 files changed, 63 insertions, 4 deletions
diff --git a/modules/launcher/AppItem.qml b/modules/launcher/AppItem.qml
index cb7f615..473797a 100644
--- a/modules/launcher/AppItem.qml
+++ b/modules/launcher/AppItem.qml
@@ -1,4 +1,5 @@
import "root:/widgets"
+import "root:/services"
import "root:/config"
import Quickshell
import Quickshell.Widgets
@@ -8,11 +9,19 @@ PaddedRect {
id: root
required property DesktopEntry modelData
+ required property Scope launcher
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"
+
+ StateLayer {
+ radius: Appearance.rounding.normal
+
+ function onClicked(): void {
+ Apps.launch(root.modelData);
+ root.launcher.launcherVisible = false;
+ }
+ }
IconImage {
id: icon
diff --git a/modules/launcher/Content.qml b/modules/launcher/Content.qml
index 92de980..4aafc3f 100644
--- a/modules/launcher/Content.qml
+++ b/modules/launcher/Content.qml
@@ -48,7 +48,9 @@ Item {
anchors.bottom: parent.bottom
anchors.margins: root.padding
- delegate: AppItem {}
+ delegate: AppItem {
+ launcher: root.launcher
+ }
ScrollBar.vertical: StyledScrollBar {
// Move half out
diff --git a/services/Apps.qml b/services/Apps.qml
index e5b7813..b78d642 100644
--- a/services/Apps.qml
+++ b/services/Apps.qml
@@ -35,8 +35,11 @@ Singleton {
Process {
required property DesktopEntry entry
- running: true
command: ["app2unit", "--", `${entry.id}.desktop`]
+ Component.onCompleted: {
+ startDetached();
+ destroy();
+ }
}
}
}
diff --git a/widgets/StateLayer.qml b/widgets/StateLayer.qml
new file mode 100644
index 0000000..e1a7b61
--- /dev/null
+++ b/widgets/StateLayer.qml
@@ -0,0 +1,45 @@
+import "root:/widgets"
+import "root:/config"
+import QtQuick
+
+Rectangle {
+ id: root
+
+ function onClicked(event: MouseEvent): void {
+ }
+
+ anchors.fill: parent
+
+ color: Appearance.colours.m3onSurface
+ opacity: mouse.pressed ? 0.1 : mouse.hovered ? 0.08 : 0
+
+ MouseArea {
+ id: mouse
+
+ property bool hovered
+
+ anchors.fill: parent
+ hoverEnabled: true
+
+ onEntered: hovered = true
+ onExited: hovered = false
+
+ onClicked: event => root.onClicked(event)
+ }
+
+ Behavior on opacity {
+ NumberAnimation {
+ duration: Appearance.anim.durations.smaller
+ easing.type: Easing.BezierSpline
+ easing.bezierCurve: Appearance.anim.curves.standard
+ }
+ }
+
+ Behavior on color {
+ ColorAnimation {
+ duration: Appearance.anim.durations.normal
+ easing.type: Easing.BezierSpline
+ easing.bezierCurve: Appearance.anim.curves.standard
+ }
+ }
+}