mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-02 09:48:50 +00:00
taskswitcher: Close if window has popped up in front
This commit is contained in:
parent
516c690038
commit
76b923f48d
1 changed files with 12 additions and 1 deletions
|
|
@ -8,6 +8,7 @@
|
||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15 as QQC2
|
import QtQuick.Controls 2.15 as QQC2
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
|
import QtQuick.Window 2.15
|
||||||
|
|
||||||
import org.kde.taskmanager 0.1 as TaskManager
|
import org.kde.taskmanager 0.1 as TaskManager
|
||||||
import org.kde.plasma.core 2.1 as PlasmaCore
|
import org.kde.plasma.core 2.1 as PlasmaCore
|
||||||
|
|
@ -33,10 +34,20 @@ Item {
|
||||||
|
|
||||||
property var displaysModel: MobileShell.DisplaysModel {}
|
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;
|
onVisibleChanged: MobileShell.HomeScreenControls.taskSwitcherVisible = visible;
|
||||||
|
|
||||||
|
// keep track of task list events
|
||||||
property int oldTasksCount: tasksCount
|
property int oldTasksCount: tasksCount
|
||||||
onTasksCountChanged: {
|
onTasksCountChanged: {
|
||||||
if (tasksCount == 0) {
|
if (tasksCount == 0) {
|
||||||
hide();
|
hide();
|
||||||
} else if (tasksCount < oldTasksCount && taskSwitcherState.currentTaskIndex >= tasksCount - 1) {
|
} else if (tasksCount < oldTasksCount && taskSwitcherState.currentTaskIndex >= tasksCount - 1) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue