diff --git a/components/mobileshell/homescreen/applicationlistmodel.cpp b/components/mobileshell/homescreen/applicationlistmodel.cpp index 797cb368..5a46b096 100644 --- a/components/mobileshell/homescreen/applicationlistmodel.cpp +++ b/components/mobileshell/homescreen/applicationlistmodel.cpp @@ -104,13 +104,13 @@ void ApplicationListModel::windowCreated(KWayland::Client::PlasmaWindow *window) for (auto i = m_applicationList.begin(); i != m_applicationList.end(); i++) { if ((*i).storageId == window->appId() + QStringLiteral(".desktop")) { (*i).window = window; - emit dataChanged(index(idx, 0), index(idx, 0)); + Q_EMIT dataChanged(index(idx, 0), index(idx, 0)); connect(window, &KWayland::Client::PlasmaWindow::unmapped, this, [this, window]() { int idx = 0; for (auto i = m_applicationList.begin(); i != m_applicationList.end(); i++) { if ((*i).storageId == window->appId() + QStringLiteral(".desktop")) { (*i).window = nullptr; - emit dataChanged(index(idx, 0), index(idx, 0)); + Q_EMIT dataChanged(index(idx, 0), index(idx, 0)); break; } idx++; diff --git a/components/mobileshell/windowutil.cpp b/components/mobileshell/windowutil.cpp index 511185f6..34540127 100644 --- a/components/mobileshell/windowutil.cpp +++ b/components/mobileshell/windowutil.cpp @@ -40,6 +40,11 @@ bool WindowUtil::allWindowsMinimized() const return m_allWindowsMinimized; } +bool WindowUtil::allWindowsMinimizedExcludingShell() const +{ + return m_allWindowsMinimizedExcludingShell; +} + bool WindowUtil::activeWindowIsShell() const { return m_activeWindowIsShell; @@ -98,17 +103,28 @@ void WindowUtil::updateActiveWindow() connect(m_activeWindow.data(), &PlasmaWindow::unmapped, this, &WindowUtil::forgetActiveWindow); } + // loop through windows bool newAllMinimized = true; + bool newAllMinimizedExcludingShell = true; for (auto *w : m_windowManagement->windows()) { - if (!w->isMinimized() && !w->skipTaskbar() && !w->isFullscreen() /*&& w->appId() != QStringLiteral("org.kde.plasmashell")*/) { + if (!w->isMinimized() && !w->skipTaskbar() && !w->isFullscreen()) { newAllMinimized = false; - break; + + if (w->appId() != QStringLiteral("org.kde.plasmashell")) { + newAllMinimizedExcludingShell = false; + } } } + if (newAllMinimized != m_allWindowsMinimized) { m_allWindowsMinimized = newAllMinimized; Q_EMIT allWindowsMinimizedChanged(); } + if (newAllMinimizedExcludingShell != m_allWindowsMinimizedExcludingShell) { + m_allWindowsMinimizedExcludingShell = newAllMinimizedExcludingShell; + Q_EMIT allWindowsMinimizedExcludingShellChanged(); + } + // TODO: connect to closeableChanged, not needed right now as KWin doesn't provide this changeable Q_EMIT hasCloseableActiveWindowChanged(); } diff --git a/components/mobileshell/windowutil.h b/components/mobileshell/windowutil.h index 25632ca6..260c02b4 100644 --- a/components/mobileshell/windowutil.h +++ b/components/mobileshell/windowutil.h @@ -23,6 +23,7 @@ class WindowUtil : public QObject Q_OBJECT Q_PROPERTY(bool showDesktop READ isShowingDesktop WRITE requestShowingDesktop NOTIFY showingDesktopChanged) Q_PROPERTY(bool allWindowsMinimized READ allWindowsMinimized NOTIFY allWindowsMinimizedChanged) + Q_PROPERTY(bool allWindowsMinimizedExcludingShell READ allWindowsMinimizedExcludingShell NOTIFY allWindowsMinimizedExcludingShellChanged) Q_PROPERTY(bool hasCloseableActiveWindow READ hasCloseableActiveWindow NOTIFY hasCloseableActiveWindowChanged) Q_PROPERTY(bool activeWindowIsShell READ activeWindowIsShell NOTIFY activeWindowIsShellChanged) @@ -30,18 +31,47 @@ public: WindowUtil(QObject *parent = nullptr); static WindowUtil *instance(); + /** + * Whether the shell is in "desktop showing" mode, where all windows + * are moved aside. + */ bool isShowingDesktop() const; + + /** + * Whether all windows are minimized, including shell windows. + */ bool allWindowsMinimized() const; + + /** + * Whether all windows are minimized, ignoring shell windows. + */ + bool allWindowsMinimizedExcludingShell() const; + + /** + * Whether the active window being shown is a shell window. + */ bool activeWindowIsShell() const; + /** + * Whether the current active window can be closed. + */ bool hasCloseableActiveWindow() const; + + /** + * Close the current active window. + */ Q_INVOKABLE void closeActiveWindow(); + + /** + * Toggle whether we are in the "desktop showing" mode. + */ Q_INVOKABLE void requestShowingDesktop(bool showingDesktop); Q_SIGNALS: void windowCreated(KWayland::Client::PlasmaWindow *window); void showingDesktopChanged(bool showingDesktop); void allWindowsMinimizedChanged(); + void allWindowsMinimizedExcludingShellChanged(); void hasCloseableActiveWindowChanged(); void activeWindowChanged(); void activeWindowIsShellChanged(); @@ -61,5 +91,6 @@ private: bool m_showingDesktop = false; bool m_allWindowsMinimized = true; + bool m_allWindowsMinimizedExcludingShell = true; bool m_activeWindowIsShell = false; }; diff --git a/containments/panel/package/contents/ui/main.qml b/containments/panel/package/contents/ui/main.qml index 5b6561d5..030868cd 100644 --- a/containments/panel/package/contents/ui/main.qml +++ b/containments/panel/package/contents/ui/main.qml @@ -23,7 +23,7 @@ import org.kde.notificationmanager 1.0 as NotificationManager Item { id: root - readonly property bool showingApp: !MobileShell.HomeScreenControls.homeScreenVisible + readonly property bool showingApp: !MobileShell.WindowUtil.allWindowsMinimizedExcludingShell readonly property color backgroundColor: topPanel.colorScopeColor Plasmoid.backgroundHints: showingApp ? PlasmaCore.Types.StandardBackground : PlasmaCore.Types.NoBackground diff --git a/containments/taskpanel/package/contents/ui/NavigationPanelComponent.qml b/containments/taskpanel/package/contents/ui/NavigationPanelComponent.qml index a7439f93..6e51f409 100644 --- a/containments/taskpanel/package/contents/ui/NavigationPanelComponent.qml +++ b/containments/taskpanel/package/contents/ui/NavigationPanelComponent.qml @@ -16,7 +16,7 @@ import org.kde.plasma.private.mobileshell 1.0 as MobileShell MobileShell.NavigationPanel { id: root - property bool appIsShown: !MobileShell.WindowUtil.allWindowsMinimized + property bool appIsShown: !MobileShell.WindowUtil.allWindowsMinimizedExcludingShell // background is: // - opaque if an app is shown or vkbd is shown