Fade the dock thumbnail popup in and out

The popup snapped to visible/hidden instantly while every other
surface in the shell uses animated transitions. Add an opacity
fade over shortDuration so it matches the rest of the motion
language. State cleanup waits for the fade-out to finish.
This commit is contained in:
Marco Allegretti 2026-04-19 09:01:28 +02:00
parent e8bb4f2483
commit c4a2574bef

View file

@ -599,7 +599,7 @@ MouseArea {
id: thumbnailShowTimer id: thumbnailShowTimer
interval: Kirigami.Units.toolTipDelay interval: Kirigami.Units.toolTipDelay
onTriggered: { onTriggered: {
thumbnailPopup.visible = true thumbnailPopup.showing = true
} }
} }
@ -607,7 +607,7 @@ MouseArea {
id: thumbnailHideTimer id: thumbnailHideTimer
interval: 300 interval: 300
onTriggered: { onTriggered: {
thumbnailPopup.visible = false thumbnailPopup.showing = false
root.hoveredTaskIndex = -1 root.hoveredTaskIndex = -1
} }
} }
@ -620,10 +620,21 @@ MouseArea {
property var windowIds: [] property var windowIds: []
property bool isGroup: false property bool isGroup: false
property bool popupHovered: false property bool popupHovered: false
property bool showing: false
function open() { visible = true } function open() { showing = true }
function close() { visible = false } function close() { showing = false }
readonly property bool opened: visible readonly property bool opened: showing
visible: showing || fadeAnim.running
opacity: showing ? 1 : 0
Behavior on opacity {
NumberAnimation {
id: fadeAnim
duration: Kirigami.Units.shortDuration
easing.type: Easing.InOutQuad
}
}
flags: Qt.ToolTip | Qt.FramelessWindowHint | Qt.WindowDoesNotAcceptFocus flags: Qt.ToolTip | Qt.FramelessWindowHint | Qt.WindowDoesNotAcceptFocus
color: "transparent" color: "transparent"
@ -650,8 +661,8 @@ MouseArea {
return Math.max(0, Math.min(Screen.height - height, delegateGlobal.y - height - Kirigami.Units.smallSpacing)) return Math.max(0, Math.min(Screen.height - height, delegateGlobal.y - height - Kirigami.Units.smallSpacing))
} }
onVisibleChanged: { onShowingChanged: {
if (!visible) { if (!showing && !fadeAnim.running) {
windowIds = [] windowIds = []
targetDelegate = null targetDelegate = null
taskIndex = -1 taskIndex = -1
@ -659,6 +670,18 @@ MouseArea {
} }
} }
Connections {
target: fadeAnim
function onRunningChanged() {
if (!fadeAnim.running && !thumbnailPopup.showing) {
thumbnailPopup.windowIds = []
thumbnailPopup.targetDelegate = null
thumbnailPopup.taskIndex = -1
thumbnailPopup.isGroup = false
}
}
}
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: Kirigami.Theme.backgroundColor color: Kirigami.Theme.backgroundColor