132 lines
3.2 KiB
QML
132 lines
3.2 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import Quickshell
|
|
import QtQuick
|
|
import qs.Components
|
|
import qs.Config
|
|
import qs.Modules as Modules
|
|
|
|
Item {
|
|
id: root
|
|
|
|
required property ShellScreen screen
|
|
required property PersistentProperties visibilities
|
|
required property var panels
|
|
|
|
readonly property bool shouldBeActive: visibilities.launcher
|
|
property int contentHeight
|
|
|
|
readonly property real maxHeight: {
|
|
let max = screen.height - Appearance.spacing.large;
|
|
if (visibilities.dashboard)
|
|
max -= panels.dashboard.nonAnimHeight;
|
|
return max;
|
|
}
|
|
|
|
onMaxHeightChanged: timer.start()
|
|
|
|
visible: height > 0
|
|
implicitHeight: 0
|
|
implicitWidth: content.implicitWidth
|
|
|
|
onShouldBeActiveChanged: {
|
|
if (shouldBeActive) {
|
|
timer.stop();
|
|
hideAnim.stop();
|
|
showAnim.start();
|
|
} else {
|
|
showAnim.stop();
|
|
hideAnim.start();
|
|
}
|
|
}
|
|
|
|
SequentialAnimation {
|
|
id: showAnim
|
|
|
|
Modules.Anim {
|
|
target: root
|
|
property: "implicitHeight"
|
|
to: root.contentHeight
|
|
duration: Appearance.anim.durations.small
|
|
easing.bezierCurve: Appearance.anim.curves.expressiveEffects
|
|
}
|
|
ScriptAction {
|
|
script: root.implicitHeight = Qt.binding(() => content.implicitHeight)
|
|
}
|
|
}
|
|
|
|
SequentialAnimation {
|
|
id: hideAnim
|
|
|
|
ScriptAction {
|
|
script: root.implicitHeight = root.implicitHeight
|
|
}
|
|
Modules.Anim {
|
|
target: root
|
|
property: "implicitHeight"
|
|
to: 0
|
|
easing.bezierCurve: Appearance.anim.curves.expressiveEffects
|
|
}
|
|
}
|
|
|
|
Connections {
|
|
target: Config.launcher
|
|
|
|
function onEnabledChanged(): void {
|
|
timer.start();
|
|
}
|
|
|
|
function onMaxShownChanged(): void {
|
|
timer.start();
|
|
}
|
|
}
|
|
|
|
Connections {
|
|
target: DesktopEntries.applications
|
|
|
|
function onValuesChanged(): void {
|
|
if (DesktopEntries.applications.values.length < Config.launcher.maxAppsShown)
|
|
timer.start();
|
|
}
|
|
}
|
|
|
|
Timer {
|
|
id: timer
|
|
|
|
interval: Appearance.anim.durations.small
|
|
onRunningChanged: {
|
|
if (running && !root.shouldBeActive) {
|
|
content.visible = false;
|
|
content.active = true;
|
|
} else {
|
|
root.contentHeight = Math.min(root.maxHeight, content.implicitHeight);
|
|
content.active = Qt.binding(() => root.shouldBeActive || root.visible);
|
|
content.visible = true;
|
|
if (showAnim.running) {
|
|
showAnim.stop();
|
|
showAnim.start();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Loader {
|
|
id: content
|
|
|
|
anchors.top: parent.top
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
visible: false
|
|
active: false
|
|
Component.onCompleted: timer.start()
|
|
|
|
sourceComponent: Content {
|
|
visibilities: root.visibilities
|
|
panels: root.panels
|
|
maxHeight: root.maxHeight
|
|
|
|
Component.onCompleted: root.contentHeight = implicitHeight
|
|
}
|
|
}
|
|
}
|