No janky stuff, use same Behavior pattern as launcher, and fix height changes breaking. Also allows for no initial load (though we still need to load Apps) And for async launcher loader
63 lines
1.8 KiB
QML
63 lines
1.8 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import QtQuick
|
|
import Quickshell
|
|
import qs.modules.launcher.services
|
|
import qs.components
|
|
import qs.config
|
|
|
|
Item {
|
|
id: root
|
|
|
|
required property ShellScreen screen
|
|
required property DrawerVisibilities visibilities
|
|
required property var panels
|
|
|
|
readonly property bool shouldBeActive: visibilities.launcher && Config.launcher.enabled
|
|
|
|
readonly property real maxHeight: {
|
|
let max = screen.height - Config.border.thickness * 2 - Appearance.spacing.large;
|
|
if (visibilities.dashboard)
|
|
max -= panels.dashboard.nonAnimHeight;
|
|
return max;
|
|
}
|
|
|
|
property real offsetScale: shouldBeActive ? 0 : 1
|
|
|
|
onShouldBeActiveChanged: {
|
|
if (shouldBeActive)
|
|
implicitHeight = Qt.binding(() => content.implicitHeight);
|
|
else
|
|
implicitHeight = implicitHeight; // Break binding during close anim
|
|
}
|
|
|
|
visible: offsetScale < 1
|
|
anchors.bottomMargin: (-implicitHeight - 5) * offsetScale
|
|
implicitHeight: content.implicitHeight
|
|
implicitWidth: content.implicitWidth || 630 // Hard coded fallback for first open
|
|
|
|
Component.onCompleted: Qt.callLater(() => Apps) // Load apps on init
|
|
|
|
Behavior on offsetScale {
|
|
Anim {
|
|
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
|
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
|
}
|
|
}
|
|
|
|
Loader {
|
|
id: content
|
|
|
|
anchors.top: parent.top
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
asynchronous: true
|
|
active: root.shouldBeActive || root.visible
|
|
|
|
sourceComponent: Content {
|
|
visibilities: root.visibilities
|
|
panels: root.panels
|
|
maxHeight: root.maxHeight
|
|
}
|
|
}
|
|
}
|