dock: fix slide-out animation by managing visibility manually

This commit is contained in:
Damocles 2026-04-25 22:02:06 +02:00
parent c6fd199bd7
commit 007c9f4eca

View file

@ -14,9 +14,11 @@ PanelWindow {
required property var screen required property var screen
visible: S.DockState.open visible: _winVisible
color: "transparent" color: "transparent"
property bool _winVisible: false
WlrLayershell.layer: S.DockState.mode === "pinned" ? WlrLayer.Top : WlrLayer.Overlay WlrLayershell.layer: S.DockState.mode === "pinned" ? WlrLayer.Top : WlrLayer.Overlay
WlrLayershell.exclusiveZone: S.DockState.mode === "pinned" ? _dockWidth : 0 WlrLayershell.exclusiveZone: S.DockState.mode === "pinned" ? _dockWidth : 0
WlrLayershell.namespace: "nova-dock" WlrLayershell.namespace: "nova-dock"
@ -47,15 +49,49 @@ PanelWindow {
} }
} }
// Slide animation // Slide animation - managed manually so window stays visible during hide
property real _slideX: S.DockState.open ? 0 : _dockWidth property real _slideX: _dockWidth
Connections {
target: S.DockState
function onOpenChanged() {
if (S.DockState.open) {
root._winVisible = true;
_hideAnim.stop();
if (S.Theme.reducedMotion) {
root._slideX = 0;
} else {
_showAnim.start();
}
} else {
_showAnim.stop();
if (S.Theme.reducedMotion) {
root._slideX = root._dockWidth;
root._winVisible = false;
} else {
_hideAnim.start();
}
}
}
}
Behavior on _slideX {
enabled: !S.Theme.reducedMotion
NumberAnimation { NumberAnimation {
id: _showAnim
target: root
property: "_slideX"
to: 0
duration: 200 duration: 200
easing.type: Easing.OutCubic easing.type: Easing.OutCubic
} }
NumberAnimation {
id: _hideAnim
target: root
property: "_slideX"
to: root._dockWidth
duration: 200
easing.type: Easing.InCubic
onFinished: root._winVisible = false
} }
// Overlay mode: close when cursor leaves // Overlay mode: close when cursor leaves