From 76b923f48d4f334d0be02440007d55e38b420c87 Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Tue, 28 Dec 2021 21:56:40 -0500 Subject: [PATCH] taskswitcher: Close if window has popped up in front --- .../mobileshell/qml/taskswitcher/TaskSwitcher.qml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/components/mobileshell/qml/taskswitcher/TaskSwitcher.qml b/components/mobileshell/qml/taskswitcher/TaskSwitcher.qml index 7e3955b6..9f989e91 100644 --- a/components/mobileshell/qml/taskswitcher/TaskSwitcher.qml +++ b/components/mobileshell/qml/taskswitcher/TaskSwitcher.qml @@ -8,6 +8,7 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 as QQC2 import QtQuick.Layouts 1.1 +import QtQuick.Window 2.15 import org.kde.taskmanager 0.1 as TaskManager import org.kde.plasma.core 2.1 as PlasmaCore @@ -33,10 +34,20 @@ Item { property var displaysModel: MobileShell.DisplaysModel {} + // if a window has popped up in front, close the task switcher + property bool windowActive: Window.active + onWindowActiveChanged: { + if (visible && !windowActive) { + hide(); + } + } + + // update API property onVisibleChanged: MobileShell.HomeScreenControls.taskSwitcherVisible = visible; + // keep track of task list events property int oldTasksCount: tasksCount - onTasksCountChanged: { + onTasksCountChanged: { if (tasksCount == 0) { hide(); } else if (tasksCount < oldTasksCount && taskSwitcherState.currentTaskIndex >= tasksCount - 1) {