mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-02 09:48:50 +00:00
taskswitcher: Bring back task preview if it doesn't close within 3 secs
This commit is contained in:
parent
aff0064b62
commit
7c710d46f3
1 changed files with 19 additions and 1 deletions
|
|
@ -64,6 +64,13 @@ Item {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|
||||||
|
property bool movingUp: false
|
||||||
|
property real oldY: y
|
||||||
|
onYChanged: {
|
||||||
|
movingUp = y < oldY;
|
||||||
|
oldY = y;
|
||||||
|
}
|
||||||
|
|
||||||
// drag up gesture
|
// drag up gesture
|
||||||
DragHandler {
|
DragHandler {
|
||||||
id: dragHandler
|
id: dragHandler
|
||||||
|
|
@ -78,7 +85,7 @@ Item {
|
||||||
onActiveChanged: {
|
onActiveChanged: {
|
||||||
yAnimator.stop();
|
yAnimator.stop();
|
||||||
|
|
||||||
if (parent.y < -PlasmaCore.Units.gridUnit * 2) {
|
if (control.movingUp && parent.y < -PlasmaCore.Units.gridUnit * 2) {
|
||||||
yAnimator.to = -root.height;
|
yAnimator.to = -root.height;
|
||||||
} else {
|
} else {
|
||||||
yAnimator.to = 0;
|
yAnimator.to = 0;
|
||||||
|
|
@ -87,6 +94,16 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the app doesn't close within a certain time, drag it back
|
||||||
|
Timer {
|
||||||
|
id: uncloseTimer
|
||||||
|
interval: 3000
|
||||||
|
onTriggered: {
|
||||||
|
yAnimator.to = 0;
|
||||||
|
yAnimator.restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NumberAnimation on y {
|
NumberAnimation on y {
|
||||||
id: yAnimator
|
id: yAnimator
|
||||||
running: !dragHandler.active
|
running: !dragHandler.active
|
||||||
|
|
@ -96,6 +113,7 @@ Item {
|
||||||
onFinished: {
|
onFinished: {
|
||||||
if (to != 0) { // close app
|
if (to != 0) { // close app
|
||||||
delegate.closeApp();
|
delegate.closeApp();
|
||||||
|
uncloseTimer.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue