nosignal-shell/modules/session/Wrapper.qml
2026-03-26 21:01:40 +11:00

49 lines
1.5 KiB
QML

pragma ComponentBehavior: Bound
import QtQuick
import qs.components
import qs.config
Item {
id: root
required property DrawerVisibilities visibilities
required property bool sidebarVisible
readonly property real nonAnimWidth: content.implicitWidth
readonly property bool shouldBeActive: visibilities.session && Config.session.enabled
property real offsetScale: shouldBeActive ? 0 : 1
property real sidebarOffset: !shouldBeActive && sidebarVisible ? 14 : 0 // TODO: there is clearly something wrong with the rect to rect edge sink
visible: offsetScale < 1
anchors.rightMargin: (-implicitWidth - 5 - sidebarOffset) * offsetScale
implicitWidth: content.implicitWidth
implicitHeight: content.implicitHeight || 510 // Hard coded fallback for first open
Behavior on offsetScale {
Anim {
duration: Appearance.anim.durations.expressiveDefaultSpatial
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
}
}
Behavior on sidebarOffset {
Anim {
duration: Appearance.anim.durations.expressiveDefaultSpatial
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
}
}
Loader {
id: content
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
active: root.shouldBeActive || root.visible
sourceComponent: Content {
visibilities: root.visibilities
}
}
}