shift-shell/components/windowplugin/qml/WindowMaximizedTracker.qml
Devin Lin 5c53f9b6d2 windowplugin: Add per-screen support for WindowMaximizedTracker
Contributes to #317

This refactor changes WindowMaximizedTracker from being a Singleton, and allows for it to be created in a way such that screens can be filtered out.

This fixes external screens from having their homescreen "zoom out" when an app is maximized on another screen.
2024-06-26 00:44:31 +00:00

45 lines
1.6 KiB
QML

// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
import QtQuick
import org.kde.plasma.core as PlasmaCore
import org.kde.taskmanager as TaskManager
import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin
import org.kde.kitemmodels as KItemModels
// Helper component that uses Plasma's tasks model to provide whether a maximized window is showing on the current screen.
QtObject {
// Setting this property is necessary to filter by screen, otherwise the model will use all screens.
// Set it to Plasmoid.containment.screenGeometry in a plasmoid to accomplish this.
property alias screenGeometry: tasksModel.screenGeometry
readonly property bool showingWindow: __internal.count > 0 && !WindowPlugin.WindowUtil.isShowingDesktop
property var __internal: KItemModels.KSortFilterProxyModel {
id: visibleMaximizedWindowsModel
filterRoleName: 'IsMinimized'
filterString: 'false'
sourceModel: TaskManager.TasksModel {
id: tasksModel
filterByVirtualDesktop: true
filterByActivity: true
filterNotMaximized: true
filterByScreen: true
filterHidden: true
virtualDesktop: virtualDesktopInfo.currentDesktop
activity: activityInfo.currentActivity
groupMode: TaskManager.TasksModel.GroupDisabled
}
property var vdi: TaskManager.VirtualDesktopInfo {
id: virtualDesktopInfo
}
property var ai: TaskManager.ActivityInfo {
id: activityInfo
}
}
}