From de1b92e0c2cfaeb5e4df7e6999f4febc5923b207 Mon Sep 17 00:00:00 2001 From: Yari Polla Date: Wed, 13 Apr 2022 15:04:55 +0200 Subject: [PATCH] taskswitcher: add support for task reordering based on opening history --- components/mobileshell/qml/homescreen/HomeScreen.qml | 2 +- components/mobileshell/qml/taskswitcher/TaskSwitcher.qml | 9 +++++++-- .../mobileshell/qml/taskswitcher/TaskSwitcherState.qml | 7 ++++--- components/mobileshell/qml/taskswitcher/Thumbnail.qml | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/components/mobileshell/qml/homescreen/HomeScreen.qml b/components/mobileshell/qml/homescreen/HomeScreen.qml index b55ea3d8..6460b5d9 100644 --- a/components/mobileshell/qml/homescreen/HomeScreen.qml +++ b/components/mobileshell/qml/homescreen/HomeScreen.qml @@ -171,7 +171,7 @@ Item { groupMode: TaskManager.TasksModel.GroupDisabled screenGeometry: plasmoid.screenGeometry - sortMode: TaskManager.TasksModel.SortAlpha + sortMode: TaskManager.TasksModel.SortLastActivated virtualDesktop: virtualDesktopInfo.currentDesktop activity: activityInfo.currentActivity diff --git a/components/mobileshell/qml/taskswitcher/TaskSwitcher.qml b/components/mobileshell/qml/taskswitcher/TaskSwitcher.qml index a8f526a1..a78a61a1 100644 --- a/components/mobileshell/qml/taskswitcher/TaskSwitcher.qml +++ b/components/mobileshell/qml/taskswitcher/TaskSwitcher.qml @@ -25,7 +25,7 @@ Item { id: root visible: false opacity: 0 - + // state object property var taskSwitcherState: TaskSwitcherState { taskSwitcher: root @@ -82,10 +82,15 @@ Item { taskSwitcherState.xPosition = 0; taskSwitcherState.wasInActiveTask = tasksModel.activeTask.row >= 0; taskSwitcherState.currentlyBeingOpened = true; - + + // disable reorder feature and the relative delay + taskSwitcher.tasksModel.requestLastActivatedReorderDelay(0); + // skip to first active task if (taskSwitcherState.wasInActiveTask) { taskSwitcherState.goToTaskIndex(tasksModel.activeTask.row); + } else { + taskSwitcherState.goToTaskIndex(tasksCount - 1); } // show task switcher, hide all running apps diff --git a/components/mobileshell/qml/taskswitcher/TaskSwitcherState.qml b/components/mobileshell/qml/taskswitcher/TaskSwitcherState.qml index 6babb014..286c3b34 100644 --- a/components/mobileshell/qml/taskswitcher/TaskSwitcherState.qml +++ b/components/mobileshell/qml/taskswitcher/TaskSwitcherState.qml @@ -157,12 +157,12 @@ QtObject { // called after a user finishes an interaction (ex. lets go of the screen) function updateState() { cancelAnimations(); - + // update vertical state - if (movingUp || root.yPosition >= openedYPosition) { + if (movingUp || root.yPosition >= openedYPosition) { // open task switcher and stay openAnim.restart(); - } else { + } else { // close task switcher and return to app closeAnim.restart(); } @@ -221,6 +221,7 @@ QtObject { taskSwitcher.instantHide(); if (root.wasInActiveTask) { + taskSwitcher.tasksModel.requestLastActivatedReorderDelay(5000); taskSwitcher.setSingleActiveWindow(root.currentTaskIndex); } } diff --git a/components/mobileshell/qml/taskswitcher/Thumbnail.qml b/components/mobileshell/qml/taskswitcher/Thumbnail.qml index 5dd3139e..9adcb183 100644 --- a/components/mobileshell/qml/taskswitcher/Thumbnail.qml +++ b/components/mobileshell/qml/taskswitcher/Thumbnail.qml @@ -15,7 +15,7 @@ TaskManager.PipeWireSourceItem { nodeId: waylandItem.nodeId onVisibleChanged: { - if (visible && waylandItem.uuid.length === 0) { + if (visible) { if (model.WinIdList) { waylandItem.uuid = model.WinIdList[0]; }