diff --git a/components/mobileshell/qml/homescreen/HomeScreen.qml b/components/mobileshell/qml/homescreen/HomeScreen.qml index 0afa7cc2..d7a55b85 100644 --- a/components/mobileshell/qml/homescreen/HomeScreen.qml +++ b/components/mobileshell/qml/homescreen/HomeScreen.qml @@ -86,7 +86,7 @@ Item { target: MobileShellState.ShellDBusClient function onOpenHomeScreenRequested() { - if (WindowPlugin.WindowMaximizedTracker.showingWindow) { + if (windowMaximizedTracker.showingWindow) { itemContainer.zoomIn(); } @@ -125,7 +125,7 @@ Item { function onIsTaskSwitcherVisibleChanged() { if (MobileShellState.ShellDBusClient.isTaskSwitcherVisible) { itemContainer.zoomOutImmediately(); - } else if (!WindowPlugin.WindowMaximizedTracker.showingWindow) { + } else if (!windowMaximizedTracker.showingWindow) { itemContainer.zoomIn(); } } @@ -151,6 +151,15 @@ Item { evaluateMargins(); } + WindowPlugin.WindowMaximizedTracker { + id: windowMaximizedTracker + screenGeometry: Plasmoid.containment.screenGeometry + + onShowingWindowChanged: { + itemContainer.evaluateAnimChange(); + } + } + // homescreen visual component MobileShell.BaseItem { id: itemContainer @@ -199,21 +208,13 @@ Item { function evaluateAnimChange() { // only animate if homescreen is visible - if (!WindowPlugin.WindowMaximizedTracker.showingWindow && !MobileShellState.ShellDBusClient.isTaskSwitcherVisible) { + if (!windowMaximizedTracker.showingWindow && !MobileShellState.ShellDBusClient.isTaskSwitcherVisible) { itemContainer.zoomIn(); } else { itemContainer.zoomOut(); } } - Connections { - target: WindowPlugin.WindowMaximizedTracker - - function onShowingWindowChanged() { - itemContainer.evaluateAnimChange(); - } - } - transform: Scale { origin.x: itemContainer.width / 2; origin.y: itemContainer.height / 2; diff --git a/components/windowplugin/CMakeLists.txt b/components/windowplugin/CMakeLists.txt index cda60266..2b3e7efd 100644 --- a/components/windowplugin/CMakeLists.txt +++ b/components/windowplugin/CMakeLists.txt @@ -5,7 +5,6 @@ ecm_add_qml_module(windowplugin URI org.kde.plasma.private.mobileshell.windowplu target_sources(windowplugin PRIVATE windowutil.cpp) -set_source_files_properties(qml/WindowMaximizedTracker.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE) ecm_target_qml_sources(windowplugin SOURCES qml/WindowMaximizedTracker.qml) target_link_libraries(windowplugin PRIVATE diff --git a/components/windowplugin/qml/WindowMaximizedTracker.qml b/components/windowplugin/qml/WindowMaximizedTracker.qml index 6b43fc7a..87611ea9 100644 --- a/components/windowplugin/qml/WindowMaximizedTracker.qml +++ b/components/windowplugin/qml/WindowMaximizedTracker.qml @@ -8,11 +8,12 @@ import org.kde.taskmanager as TaskManager import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin import org.kde.kitemmodels as KItemModels -pragma Singleton - // 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 { diff --git a/containments/homescreens/folio/package/contents/ui/main.qml b/containments/homescreens/folio/package/contents/ui/main.qml index 42394dfc..59a9e987 100644 --- a/containments/homescreens/folio/package/contents/ui/main.qml +++ b/containments/homescreens/folio/package/contents/ui/main.qml @@ -72,8 +72,13 @@ ContainmentItem { } } + WindowPlugin.WindowMaximizedTracker { + id: windowMaximizedTracker + screenGeometry: Plasmoid.containment.screenGeometry + } + function homeAction() { - const isInWindow = (!WindowPlugin.WindowUtil.isShowingDesktop && WindowPlugin.WindowMaximizedTracker.showingWindow); + const isInWindow = (!WindowPlugin.WindowUtil.isShowingDesktop && windowMaximizedTracker.showingWindow); // Always close action drawer if (MobileShellState.ShellDBusClient.isActionDrawerOpen) { diff --git a/containments/homescreens/halcyon/package/contents/ui/HomeScreen.qml b/containments/homescreens/halcyon/package/contents/ui/HomeScreen.qml index 262b10fe..52ff1c0a 100644 --- a/containments/homescreens/halcyon/package/contents/ui/HomeScreen.qml +++ b/containments/homescreens/halcyon/package/contents/ui/HomeScreen.qml @@ -16,7 +16,7 @@ import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin Item { id: root - + required property real topMargin required property real bottomMargin required property real leftMargin @@ -24,7 +24,7 @@ Item { required property bool interactive required property var searchWidget - + property alias page: swipeView.currentIndex property bool settingsOpen: false @@ -41,7 +41,7 @@ Item { favoritesView.goToBeginning(); gridAppList.goToBeginning(); } - + function openConfigure() { settingsOpen = true; } @@ -51,11 +51,12 @@ Item { Plasmoid.editMode = false; } - Connections { - target: WindowPlugin.WindowMaximizedTracker + WindowPlugin.WindowMaximizedTracker { + id: windowMaximizedTracker + screenGeometry: Plasmoid.containment.screenGeometry - function onShowingWindowChanged(){ - if (WindowPlugin.WindowMaximizedTracker.showingWindow) { + onShowingWindowChanged: { + if (windowMaximizedTracker.showingWindow) { swipeView.focusChild(); } } @@ -75,7 +76,7 @@ Item { id: swipeView opacity: Math.min(1 - root.settingsOpenFactor, 1 - searchWidget.openFactor) interactive: root.interactive - + anchors.fill: parent anchors.topMargin: root.topMargin anchors.bottomMargin: root.bottomMargin @@ -104,7 +105,7 @@ Item { onLongPressed: root.openConfigure() } - + FavoritesView { id: favoritesView anchors.fill: parent @@ -128,7 +129,7 @@ Item { GridAppList { id: gridAppList - + anchors.fill: parent property int horizontalMargin: Math.round(swipeView.width * 0.05) diff --git a/containments/homescreens/halcyon/package/contents/ui/main.qml b/containments/homescreens/halcyon/package/contents/ui/main.qml index 4bc1103a..7a9496a5 100644 --- a/containments/homescreens/halcyon/package/contents/ui/main.qml +++ b/containments/homescreens/halcyon/package/contents/ui/main.qml @@ -16,13 +16,13 @@ import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin ContainmentItem { id: root - + Component.onCompleted: { Halcyon.ApplicationListModel.loadApplications(); Halcyon.PinnedModel.applet = root.plasmoid; forceActiveFocus(); } - + Plasmoid.onActivated: { // there's a couple of steps: // - minimize windows (only if we are in an app) @@ -34,7 +34,7 @@ ContainmentItem { MobileShellState.ShellDBusClient.closeActionDrawer(); } - if (!WindowPlugin.WindowUtil.isShowingDesktop && WindowPlugin.WindowMaximizedTracker.showingWindow || search.isOpen) { + if (!WindowPlugin.WindowUtil.isShowingDesktop && windowMaximizedTracker.showingWindow || search.isOpen) { // Always close the search widget as well if (search.isOpen) { search.close(); @@ -51,6 +51,11 @@ ContainmentItem { } } + WindowPlugin.WindowMaximizedTracker { + id: windowMaximizedTracker + screenGeometry: Plasmoid.containment.screenGeometry + } + Rectangle { id: darkenBackground color: homeScreen.overlayShown ? 'transparent' : (halcyonHomeScreen.page == 1 ? Qt.rgba(0, 0, 0, 0.7) : Qt.rgba(0, 0, 0, 0.2)) diff --git a/containments/panel/package/contents/ui/main.qml b/containments/panel/package/contents/ui/main.qml index 54f88ebf..90eb42b9 100644 --- a/containments/panel/package/contents/ui/main.qml +++ b/containments/panel/package/contents/ui/main.qml @@ -34,9 +34,14 @@ ContainmentItem { } // only opaque if there are no maximized windows on this screen - readonly property bool showingApp: WindowPlugin.WindowMaximizedTracker.showingWindow + readonly property bool showingApp: windowMaximizedTracker.showingWindow readonly property color backgroundColor: topPanel.colorScopeColor + WindowPlugin.WindowMaximizedTracker { + id: windowMaximizedTracker + screenGeometry: Plasmoid.containment.screenGeometry + } + // enforce thickness Binding { target: panel // assumed to be plasma-workspace "PanelView" component diff --git a/containments/taskpanel/package/contents/ui/main.qml b/containments/taskpanel/package/contents/ui/main.qml index 6e7d6e6b..ca76f979 100644 --- a/containments/taskpanel/package/contents/ui/main.qml +++ b/containments/taskpanel/package/contents/ui/main.qml @@ -110,7 +110,12 @@ ContainmentItem { Component.onCompleted: setWindowProperties(); // only opaque if there are no maximized windows on this screen - readonly property bool opaqueBar: WindowPlugin.WindowMaximizedTracker.showingWindow + readonly property bool opaqueBar: windowMaximizedTracker.showingWindow + + WindowPlugin.WindowMaximizedTracker { + id: windowMaximizedTracker + screenGeometry: Plasmoid.containment.screenGeometry + } Item { anchors.fill: parent