launcher: animate content
This commit is contained in:
parent
651378d496
commit
bfffe0ccf7
3 changed files with 72 additions and 9 deletions
|
|
@ -4,8 +4,14 @@ import Quickshell
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Scope launcher
|
||||||
|
|
||||||
implicitWidth: LauncherConfig.sizes.width
|
implicitWidth: LauncherConfig.sizes.width
|
||||||
implicitHeight: search.height + list.height + Appearance.padding.large * 5 // Don't question it
|
implicitHeight: search.height + list.height + Appearance.padding.large * 5 // Don't question it
|
||||||
|
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
StyledRect {
|
StyledRect {
|
||||||
|
|
@ -22,12 +28,16 @@ Item {
|
||||||
ListView {
|
ListView {
|
||||||
id: list
|
id: list
|
||||||
|
|
||||||
model: DesktopEntries.applications.values.filter(x => x.name.toLowerCase().includes(search.text.toLowerCase()))
|
model: ScriptModel {
|
||||||
|
// TODO: sort
|
||||||
|
values: DesktopEntries.applications.values.filter(x => x.name.toLowerCase().includes(search.text.toLowerCase()))
|
||||||
|
}
|
||||||
|
|
||||||
|
clip: true
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
orientation: Qt.Vertical
|
orientation: Qt.Vertical
|
||||||
verticalLayoutDirection: Qt.BottomToTop
|
verticalLayoutDirection: Qt.BottomToTop
|
||||||
height: 100
|
implicitHeight: ((currentItem?.height ?? 1) + spacing) * Math.min(10, count) - spacing
|
||||||
width: 100
|
|
||||||
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
@ -39,7 +49,8 @@ Item {
|
||||||
|
|
||||||
required property DesktopEntry modelData
|
required property DesktopEntry modelData
|
||||||
|
|
||||||
width: LauncherConfig.sizes.width
|
radius: Appearance.rounding.normal
|
||||||
|
color: Appearance.alpha(Appearance.colours.m3surfaceContainerHighest, true)
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: modelData.name
|
text: modelData.name
|
||||||
|
|
@ -47,6 +58,40 @@ Item {
|
||||||
font.pointSize: Appearance.font.size.smaller
|
font.pointSize: Appearance.font.size.smaller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add: Transition {
|
||||||
|
Anim {
|
||||||
|
properties: "opacity,scale"
|
||||||
|
from: 0
|
||||||
|
to: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
remove: Transition {
|
||||||
|
Anim {
|
||||||
|
properties: "opacity,scale"
|
||||||
|
from: 1
|
||||||
|
to: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addDisplaced: Transition {
|
||||||
|
Anim {
|
||||||
|
properties: "x,y"
|
||||||
|
duration: Appearance.anim.durations.small
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
removeDisplaced: Transition {
|
||||||
|
Anim {
|
||||||
|
properties: "x,y"
|
||||||
|
duration: Appearance.anim.durations.large
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitHeight {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -58,11 +103,23 @@ Item {
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.margins: Appearance.padding.large
|
anchors.margins: Appearance.padding.large
|
||||||
|
|
||||||
placeholderText: "Type \">\" for commands"
|
placeholderText: qsTr("Type \">\" for commands")
|
||||||
|
|
||||||
background: StyledRect {
|
background: StyledRect {
|
||||||
color: Appearance.alpha(Appearance.colours.m3surfaceContainerHigh, true)
|
color: Appearance.alpha(Appearance.colours.m3surfaceContainerHigh, true)
|
||||||
radius: Appearance.rounding.large
|
radius: Appearance.rounding.large
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: apps service with launch
|
||||||
|
// onAccepted: console.log(list.currentItem?.modelData.id)
|
||||||
|
|
||||||
|
// TODO: key press grab focus + close on esc anywhere
|
||||||
|
Keys.onEscapePressed: root.launcher.launcherVisible = false
|
||||||
|
}
|
||||||
|
|
||||||
|
component Anim: NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,11 @@ Scope {
|
||||||
visible: wrapper.shouldBeVisible
|
visible: wrapper.shouldBeVisible
|
||||||
|
|
||||||
width: content.width + bg.rounding * 2
|
width: content.width + bg.rounding * 2
|
||||||
height: content.implicitHeight
|
mask: Region {
|
||||||
|
item: wrapper
|
||||||
|
}
|
||||||
|
|
||||||
|
anchors.top: true
|
||||||
anchors.bottom: true
|
anchors.bottom: true
|
||||||
|
|
||||||
Background {
|
Background {
|
||||||
|
|
@ -36,9 +39,12 @@ Scope {
|
||||||
id: wrapper
|
id: wrapper
|
||||||
|
|
||||||
launcherVisible: root.launcherVisible
|
launcherVisible: root.launcherVisible
|
||||||
|
contentHeight: content.height
|
||||||
|
|
||||||
Content {
|
Content {
|
||||||
id: content
|
id: content
|
||||||
|
|
||||||
|
launcher: root
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property bool launcherVisible
|
required property bool launcherVisible
|
||||||
|
required property real contentHeight
|
||||||
property bool shouldBeVisible
|
property bool shouldBeVisible
|
||||||
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
|
@ -12,7 +13,6 @@ Item {
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
height: 0
|
height: 0
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
states: State {
|
states: State {
|
||||||
|
|
@ -20,7 +20,7 @@ Item {
|
||||||
when: root.launcherVisible
|
when: root.launcherVisible
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
root.height: content.height
|
root.height: contentHeight
|
||||||
root.shouldBeVisible: true
|
root.shouldBeVisible: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -52,7 +52,7 @@ Item {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
target: root
|
target: root
|
||||||
property: "height"
|
property: "height"
|
||||||
duration: Appearance.anim.durations.extraLarge
|
duration: Appearance.anim.durations.normal
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.BezierSpline
|
||||||
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue