refactor: move launcher app list into separate file
This commit is contained in:
parent
587760810c
commit
6b848b0f56
2 changed files with 92 additions and 76 deletions
89
modules/launcher/AppList.qml
Normal file
89
modules/launcher/AppList.qml
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
import "root:/widgets"
|
||||
import "root:/services"
|
||||
import "root:/config"
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
ListView {
|
||||
id: root
|
||||
|
||||
required property int padding
|
||||
required property string search
|
||||
|
||||
model: ScriptModel {
|
||||
values: Apps.fuzzyQuery(root.search)
|
||||
onValuesChanged: root.currentIndex = 0
|
||||
}
|
||||
|
||||
clip: true
|
||||
spacing: Appearance.spacing.small
|
||||
orientation: Qt.Vertical
|
||||
implicitHeight: ((currentItem?.height ?? 1) + spacing) * Math.min(LauncherConfig.maxShown, count) - spacing
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.margins: root.padding
|
||||
|
||||
delegate: AppItem {
|
||||
launcher: root.launcher
|
||||
}
|
||||
// TODO highlight
|
||||
|
||||
ScrollBar.vertical: StyledScrollBar {
|
||||
// Move half out
|
||||
parent: root.parent
|
||||
anchors.top: root.top
|
||||
anchors.bottom: root.bottom
|
||||
anchors.right: root.right
|
||||
anchors.topMargin: root.padding / 2
|
||||
anchors.bottomMargin: root.padding / 2
|
||||
anchors.rightMargin: -root.padding / 2
|
||||
}
|
||||
|
||||
add: Transition {
|
||||
Anim {
|
||||
properties: "opacity,scale"
|
||||
from: 0
|
||||
to: 1
|
||||
}
|
||||
}
|
||||
|
||||
remove: Transition {
|
||||
Anim {
|
||||
properties: "opacity,scale"
|
||||
from: 1
|
||||
to: 0
|
||||
}
|
||||
}
|
||||
|
||||
move: Transition {
|
||||
Anim {
|
||||
property: "y"
|
||||
}
|
||||
}
|
||||
|
||||
addDisplaced: Transition {
|
||||
Anim {
|
||||
property: "y"
|
||||
duration: Appearance.anim.durations.small
|
||||
}
|
||||
}
|
||||
|
||||
displaced: Transition {
|
||||
Anim {
|
||||
property: "y"
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on implicitHeight {
|
||||
Anim {}
|
||||
}
|
||||
|
||||
component Anim: NumberAnimation {
|
||||
duration: Appearance.anim.durations.normal
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.standard
|
||||
}
|
||||
}
|
||||
|
|
@ -32,78 +32,11 @@ Item {
|
|||
anchors.bottomMargin: root.spacing
|
||||
anchors.margins: root.padding
|
||||
|
||||
ListView {
|
||||
AppList {
|
||||
id: list
|
||||
|
||||
model: ScriptModel {
|
||||
values: Apps.fuzzyQuery(search.text)
|
||||
onValuesChanged: list.currentIndex = 0
|
||||
}
|
||||
|
||||
clip: true
|
||||
spacing: Appearance.spacing.small
|
||||
orientation: Qt.Vertical
|
||||
implicitHeight: ((currentItem?.height ?? 1) + spacing) * Math.min(LauncherConfig.maxShown, count) - spacing
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.margins: root.padding
|
||||
|
||||
delegate: AppItem {
|
||||
launcher: root.launcher
|
||||
}
|
||||
// TODO highlight
|
||||
|
||||
ScrollBar.vertical: StyledScrollBar {
|
||||
// Move half out
|
||||
parent: list.parent
|
||||
anchors.top: list.top
|
||||
anchors.bottom: list.bottom
|
||||
anchors.right: list.right
|
||||
anchors.topMargin: root.padding / 2
|
||||
anchors.bottomMargin: root.padding / 2
|
||||
anchors.rightMargin: -root.padding / 2
|
||||
}
|
||||
|
||||
add: Transition {
|
||||
Anim {
|
||||
properties: "opacity,scale"
|
||||
from: 0
|
||||
to: 1
|
||||
}
|
||||
}
|
||||
|
||||
remove: Transition {
|
||||
Anim {
|
||||
properties: "opacity,scale"
|
||||
from: 1
|
||||
to: 0
|
||||
}
|
||||
}
|
||||
|
||||
move: Transition {
|
||||
Anim {
|
||||
property: "y"
|
||||
}
|
||||
}
|
||||
|
||||
addDisplaced: Transition {
|
||||
Anim {
|
||||
property: "y"
|
||||
duration: Appearance.anim.durations.small
|
||||
}
|
||||
}
|
||||
|
||||
displaced: Transition {
|
||||
Anim {
|
||||
property: "y"
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on implicitHeight {
|
||||
Anim {}
|
||||
}
|
||||
padding: root.padding
|
||||
search: search.text
|
||||
}
|
||||
|
||||
EmptyIndicator {
|
||||
|
|
@ -153,10 +86,4 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
component Anim: NumberAnimation {
|
||||
duration: Appearance.anim.durations.normal
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.standard
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue