launcher: list item interactivity
This commit is contained in:
parent
bbe650e327
commit
1ec02cb54e
4 changed files with 63 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import "root:/widgets"
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
import "root:/config"
|
import "root:/config"
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Widgets
|
import Quickshell.Widgets
|
||||||
|
|
@ -8,11 +9,19 @@ PaddedRect {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property DesktopEntry modelData
|
required property DesktopEntry modelData
|
||||||
|
required property Scope launcher
|
||||||
|
|
||||||
implicitWidth: ListView.view.width
|
implicitWidth: ListView.view.width
|
||||||
padding: [Appearance.padding.smaller, Appearance.padding.normal]
|
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 {
|
IconImage {
|
||||||
id: icon
|
id: icon
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,9 @@ Item {
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.margins: root.padding
|
anchors.margins: root.padding
|
||||||
|
|
||||||
delegate: AppItem {}
|
delegate: AppItem {
|
||||||
|
launcher: root.launcher
|
||||||
|
}
|
||||||
|
|
||||||
ScrollBar.vertical: StyledScrollBar {
|
ScrollBar.vertical: StyledScrollBar {
|
||||||
// Move half out
|
// Move half out
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,11 @@ Singleton {
|
||||||
Process {
|
Process {
|
||||||
required property DesktopEntry entry
|
required property DesktopEntry entry
|
||||||
|
|
||||||
running: true
|
|
||||||
command: ["app2unit", "--", `${entry.id}.desktop`]
|
command: ["app2unit", "--", `${entry.id}.desktop`]
|
||||||
|
Component.onCompleted: {
|
||||||
|
startDetached();
|
||||||
|
destroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
45
widgets/StateLayer.qml
Normal file
45
widgets/StateLayer.qml
Normal file
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue