mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-04 10:44:46 +00:00
better task switch behavior
close should always close now peek fixed unintended task activation shouldn't happen anymore
This commit is contained in:
parent
475d32d0a7
commit
469aac0542
3 changed files with 50 additions and 16 deletions
|
|
@ -32,8 +32,9 @@ Item {
|
||||||
//Workaround
|
//Workaround
|
||||||
property bool active: model.IsActive
|
property bool active: model.IsActive
|
||||||
onActiveChanged: {
|
onActiveChanged: {
|
||||||
|
//sometimes the task switcher window itself appears, screwing up the state
|
||||||
if (model.IsActive) {
|
if (model.IsActive) {
|
||||||
window.currentTaskIndex = index
|
// window.currentTaskIndex = index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -88,8 +89,8 @@ Item {
|
||||||
}
|
}
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
radius: units.gridUnit
|
radius: units.smallSpacing
|
||||||
opacity: 0.8 * (1-Math.abs(x)/width)
|
opacity: 0.9 * (1-Math.abs(x)/width)
|
||||||
PlasmaCore.IconItem {
|
PlasmaCore.IconItem {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: Math.min(parent.width, parent.height) / 2
|
width: Math.min(parent.width, parent.height) / 2
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ FullScreenPanel {
|
||||||
property int tasksCount: filteredWindowModel.count
|
property int tasksCount: filteredWindowModel.count
|
||||||
property int currentTaskIndex: -1
|
property int currentTaskIndex: -1
|
||||||
|
|
||||||
color: Qt.rgba(0, 0, 0, 0.6 * Math.min(
|
color: Qt.rgba(0, 0, 0, 0.8 * Math.min(
|
||||||
(Math.min(tasksView.contentY + tasksView.height, tasksView.height) / tasksView.height),
|
(Math.min(tasksView.contentY + tasksView.height, tasksView.height) / tasksView.height),
|
||||||
((tasksView.contentHeight - tasksView.contentY - tasksView.headerItem.height - tasksView.footerItem.height)/tasksView.height)))
|
((tasksView.contentHeight - tasksView.contentY - tasksView.headerItem.height - tasksView.footerItem.height)/tasksView.height)))
|
||||||
|
|
||||||
|
|
@ -75,13 +75,10 @@ FullScreenPanel {
|
||||||
plasmoid.nativeInterface.windowModel.requestToggleMinimized(filteredWindowModel.mapRowToSource(i));
|
plasmoid.nativeInterface.windowModel.requestToggleMinimized(filteredWindowModel.mapRowToSource(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id >= 0) {
|
if (id >= 0) {
|
||||||
plasmoid.nativeInterface.windowModel.requestActivate(filteredWindowModel.mapRowToSource(id));
|
plasmoid.nativeInterface.windowModel.requestActivate(filteredWindowModel.mapRowToSource(id));
|
||||||
} else {
|
currentTaskIndex = id;
|
||||||
plasmoid.nativeInterface.forgetActiveWindow();
|
|
||||||
}
|
}
|
||||||
currentTaskIndex = id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onOffsetChanged: tasksView.contentY = offset
|
onOffsetChanged: tasksView.contentY = offset
|
||||||
|
|
@ -207,8 +204,9 @@ FullScreenPanel {
|
||||||
}
|
}
|
||||||
iconSource: "go-home"
|
iconSource: "go-home"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
window.hide();
|
currentTaskIndex = -1;
|
||||||
setSingleActiveWindow(-1);
|
setSingleActiveWindow(-1);
|
||||||
|
window.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component.onCompleted: plasmoid.nativeInterface.panel = window;
|
Component.onCompleted: plasmoid.nativeInterface.panel = window;
|
||||||
|
|
|
||||||
|
|
@ -47,12 +47,22 @@ PlasmaCore.ColorScope {
|
||||||
id: mainMouseArea
|
id: mainMouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
property int oldMouseY: 0
|
property int oldMouseY: 0
|
||||||
|
property int startMouseY: 0
|
||||||
|
property bool isDragging: false
|
||||||
drag.filterChildren: true
|
drag.filterChildren: true
|
||||||
onPressed: {
|
function managePressed(mouse) {
|
||||||
oldMouseY = mouse.y;
|
startMouseY = oldMouseY = mouse.y;
|
||||||
taskSwitcher.offset = -taskSwitcher.height
|
taskSwitcher.offset = -taskSwitcher.height
|
||||||
}
|
}
|
||||||
|
onPressed: managePressed();
|
||||||
onPositionChanged: {
|
onPositionChanged: {
|
||||||
|
if (!isDragging && Math.abs(startMouseY - oldMouseY) < root.height) {
|
||||||
|
oldMouseY = mouse.y;
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
isDragging = true;
|
||||||
|
}
|
||||||
|
|
||||||
taskSwitcher.offset = taskSwitcher.offset - (mouse.y - oldMouseY);
|
taskSwitcher.offset = taskSwitcher.offset - (mouse.y - oldMouseY);
|
||||||
oldMouseY = mouse.y;
|
oldMouseY = mouse.y;
|
||||||
if (taskSwitcher.visibility == Window.Hidden && taskSwitcher.offset > -taskSwitcher.height + units.gridUnit && taskSwitcher.tasksCount) {
|
if (taskSwitcher.visibility == Window.Hidden && taskSwitcher.offset > -taskSwitcher.height + units.gridUnit && taskSwitcher.tasksCount) {
|
||||||
|
|
@ -61,10 +71,15 @@ PlasmaCore.ColorScope {
|
||||||
taskSwitcher.setSingleActiveWindow(-1);
|
taskSwitcher.setSingleActiveWindow(-1);
|
||||||
}
|
}
|
||||||
onReleased: {
|
onReleased: {
|
||||||
|
if (!isDragging) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (taskSwitcher.visibility == Window.Hidden) {
|
if (taskSwitcher.visibility == Window.Hidden) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (taskSwitcher.offset > -taskSwitcher.height/2) {
|
if (taskSwitcher.offset > -taskSwitcher.height/2) {
|
||||||
|
taskSwitcher.currentTaskIndex = -1
|
||||||
taskSwitcher.show();
|
taskSwitcher.show();
|
||||||
} else {
|
} else {
|
||||||
taskSwitcher.hide();
|
taskSwitcher.hide();
|
||||||
|
|
@ -85,9 +100,13 @@ PlasmaCore.ColorScope {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: parent.width/3
|
width: parent.width/3
|
||||||
enabled: taskSwitcher.tasksCount > 0
|
enabled: taskSwitcher.tasksCount > 0 && plasmoid.nativeInterface.hasCloseableActiveWindow;
|
||||||
iconSource: "window-list"
|
iconSource: "window-list"
|
||||||
onClicked: taskSwitcher.visible ? taskSwitcher.hide() : taskSwitcher.show();
|
onClicked: {
|
||||||
|
taskSwitcher.currentTaskIndex = -1;
|
||||||
|
taskSwitcher.visible ? taskSwitcher.hide() : taskSwitcher.show();
|
||||||
|
}
|
||||||
|
onPressed: mainMouseArea.managePressed(mouse);
|
||||||
onPositionChanged: mainMouseArea.positionChanged(mouse);
|
onPositionChanged: mainMouseArea.positionChanged(mouse);
|
||||||
onReleased: mainMouseArea.released(mouse);
|
onReleased: mainMouseArea.released(mouse);
|
||||||
}
|
}
|
||||||
|
|
@ -98,11 +117,26 @@ PlasmaCore.ColorScope {
|
||||||
width: parent.width/3
|
width: parent.width/3
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
iconSource: "go-home"
|
iconSource: "go-home"
|
||||||
onClicked: {
|
enabled: taskSwitcher.tasksCount > 0
|
||||||
root.taskSwitcher.setSingleActiveWindow(-1);
|
checkable: true
|
||||||
|
onCheckedChanged: {
|
||||||
|
if (checked) {
|
||||||
|
root.taskSwitcher.setSingleActiveWindow(-1);
|
||||||
|
} else {
|
||||||
|
root.taskSwitcher.setSingleActiveWindow(root.taskSwitcher.currentTaskIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
onPressed: mainMouseArea.managePressed(mouse);
|
||||||
onPositionChanged: mainMouseArea.positionChanged(mouse);
|
onPositionChanged: mainMouseArea.positionChanged(mouse);
|
||||||
onReleased: mainMouseArea.released(mouse);
|
onReleased: mainMouseArea.released(mouse);
|
||||||
|
Connections {
|
||||||
|
target: root.taskSwitcher
|
||||||
|
onCurrentTaskIndexChanged: {
|
||||||
|
if (root.taskSwitcher.currentTaskIndex < 0) {
|
||||||
|
showDesktopButton.checked = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
|
|
@ -112,6 +146,7 @@ PlasmaCore.ColorScope {
|
||||||
iconSource: "window-close"
|
iconSource: "window-close"
|
||||||
enabled: plasmoid.nativeInterface.hasCloseableActiveWindow;
|
enabled: plasmoid.nativeInterface.hasCloseableActiveWindow;
|
||||||
onClicked: plasmoid.nativeInterface.closeActiveWindow();
|
onClicked: plasmoid.nativeInterface.closeActiveWindow();
|
||||||
|
onPressed: mainMouseArea.managePressed(mouse);
|
||||||
onPositionChanged: mainMouseArea.positionChanged(mouse);
|
onPositionChanged: mainMouseArea.positionChanged(mouse);
|
||||||
onReleased: mainMouseArea.released(mouse);
|
onReleased: mainMouseArea.released(mouse);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue