close applications with swipe

This commit is contained in:
Marco Martin 2014-11-28 19:18:28 +01:00
parent 4b71d0b0d8
commit 2d822299f1

View file

@ -28,29 +28,47 @@ WindowWrapper {
compositorRoot.layers.windows.contentX = x; compositorRoot.layers.windows.contentX = x;
} }
} }
Behavior on y {
enabled: !mouse.active
SequentialAnimation {
NumberAnimation {
easing.type: "InOutQuad"
duration: units.longDuration
}
ScriptAction {
script: {
if (window.opacity < 0.3) {
window.close();
}
}
}
}
}
opacity: 1 - (Math.abs(y) / height)
MouseArea { MouseArea {
id: mouse
z: 99 z: 99
anchors.fill: parent anchors.fill: parent
enabled: compositorRoot.layers.windows.switchMode enabled: compositorRoot.layers.windows.switchMode
property bool active
onPressed: {
active = true;
}
onClicked: { onClicked: {
compositorRoot.currentWindow = window compositorRoot.currentWindow = window
} }
onReleased: {
PlasmaCore.IconItem { active = false;
anchors { if (window.opacity < 0.3) {
right: parent.right window.y = (window.y > 0 ? +1 : -1) * window.height;
bottom: parent.bottom } else {
} window.y = 0;
visible: compositorRoot.layers.windows.switchMode
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
width: units.iconSizes.smallMedium
height: width
source: "window-close"
MouseArea {
anchors.fill: parent
onClicked: window.close()
} }
} }
drag {
axis: Drag.YAxis
target: window
}
} }
} }