nosignal-shell/modules/launcher/Wrapper.qml
2026-05-06 19:52:08 +10:00

60 lines
1.6 KiB
QML

pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import Caelestia.Config
import qs.components
import qs.modules.launcher.services
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 + Tokens.padding.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
opacity: 1 - offsetScale
Component.onCompleted: Qt.callLater(() => Apps) // Load apps on init
Behavior on offsetScale {
Anim {}
}
Loader {
id: content
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
active: root.shouldBeActive || root.visible
sourceComponent: Content {
visibilities: root.visibilities
panels: root.panels
maxHeight: root.maxHeight
}
}
}