From b0d89791785c17c603cf350c28862570fe328ebf Mon Sep 17 00:00:00 2001 From: Dashon Wells Date: Wed, 18 Oct 2023 14:27:56 +0000 Subject: [PATCH] plugins/overview: Make Window Filtering Optional This commit makes window filtering optional by providing a checkbox in Desktop Effects > Overview > Overview Configuration KCM. The referenced bug report describes a bunch of the reasons why people wanted this option. BUG: 460710 FIXED-IN: 6.0 --- src/plugins/overview/kcm/overvieweffectkcm.ui | 16 +++++++++++++++- src/plugins/overview/overviewconfig.kcfg | 3 +++ src/plugins/overview/overvieweffect.cpp | 14 ++++++++++++++ src/plugins/overview/overvieweffect.h | 6 ++++++ src/plugins/overview/qml/main.qml | 9 +++++---- 5 files changed, 43 insertions(+), 5 deletions(-) diff --git a/src/plugins/overview/kcm/overvieweffectkcm.ui b/src/plugins/overview/kcm/overvieweffectkcm.ui index d7eddc32e3..7d2e3aad93 100644 --- a/src/plugins/overview/kcm/overvieweffectkcm.ui +++ b/src/plugins/overview/kcm/overvieweffectkcm.ui @@ -65,7 +65,21 @@ - + + + + Search results include filtered windows: + + + + + + + + + + + diff --git a/src/plugins/overview/overviewconfig.kcfg b/src/plugins/overview/overviewconfig.kcfg index d171e68b49..c6be99aa1f 100644 --- a/src/plugins/overview/overviewconfig.kcfg +++ b/src/plugins/overview/overviewconfig.kcfg @@ -16,6 +16,9 @@ false + + true + true diff --git a/src/plugins/overview/overvieweffect.cpp b/src/plugins/overview/overvieweffect.cpp index 8b2dc1b380..cfff22ea1b 100644 --- a/src/plugins/overview/overvieweffect.cpp +++ b/src/plugins/overview/overvieweffect.cpp @@ -168,6 +168,7 @@ void OverviewEffect::reconfigure(ReconfigureFlags) OverviewConfig::self()->read(); setLayout(OverviewConfig::layoutMode()); setAnimationDuration(animationTime(300)); + setFilterWindows(OverviewConfig::filterWindows()); for (const ElectricBorder &border : std::as_const(m_borderActivate)) { effects->unreserveElectricBorder(border, this); @@ -197,6 +198,19 @@ void OverviewEffect::setAnimationDuration(int duration) } } +bool OverviewEffect::filterWindows() const +{ + return m_filterWindows; +} + +void OverviewEffect::setFilterWindows(bool filterWindows) +{ + if (m_filterWindows != filterWindows) { + m_filterWindows = filterWindows; + Q_EMIT filterWindowsChanged(); + } +} + qreal OverviewEffect::overviewPartialActivationFactor() const { return m_overviewState->partialActivationFactor(); diff --git a/src/plugins/overview/overvieweffect.h b/src/plugins/overview/overvieweffect.h index 31958fa9c1..a361299ae8 100644 --- a/src/plugins/overview/overvieweffect.h +++ b/src/plugins/overview/overvieweffect.h @@ -18,6 +18,7 @@ class OverviewEffect : public QuickSceneEffect Q_PROPERTY(int animationDuration READ animationDuration NOTIFY animationDurationChanged) Q_PROPERTY(int layout READ layout NOTIFY layoutChanged) Q_PROPERTY(bool ignoreMinimized READ ignoreMinimized NOTIFY ignoreMinimizedChanged) + Q_PROPERTY(bool filterWindows READ filterWindows NOTIFY filterWindowsChanged) Q_PROPERTY(bool organizedGrid READ organizedGrid NOTIFY organizedGridChanged) Q_PROPERTY(qreal overviewPartialActivationFactor READ overviewPartialActivationFactor NOTIFY overviewPartialActivationFactorChanged) // More efficient from a property binding pov rather than checking if partialActivationFactor is strictly between 0 and 1 @@ -39,6 +40,9 @@ public: bool ignoreMinimized() const; bool organizedGrid() const; + bool filterWindows() const; + void setFilterWindows(bool filterWindows); + int animationDuration() const; void setAnimationDuration(int duration); @@ -67,6 +71,7 @@ Q_SIGNALS: void gridPartialActivationFactorChanged(); void gridGestureInProgressChanged(); void ignoreMinimizedChanged(); + void filterWindowsChanged(); void organizedGridChanged(); void desktopOffsetChanged(); void searchTextChanged(); @@ -93,6 +98,7 @@ private: QList m_borderActivate; QString m_searchText; QPointF m_desktopOffset; + bool m_filterWindows = true; int m_animationDuration = 400; int m_layout = 1; }; diff --git a/src/plugins/overview/qml/main.qml b/src/plugins/overview/qml/main.qml index ff844636cb..24cfc77e04 100644 --- a/src/plugins/overview/qml/main.qml +++ b/src/plugins/overview/qml/main.qml @@ -262,7 +262,7 @@ FocusScope { effect.searchTextChanged() } Keys.priority: Keys.BeforeItem - Keys.forwardTo: text && allDesktopHeaps.currentHeap.count === 0 ? searchResults : allDesktopHeaps.currentHeap + Keys.forwardTo: text && (allDesktopHeaps.currentHeap.count === 0 || !effect.filterWindows) ? searchResults : allDesktopHeaps.currentHeap text: effect.searchText onTextEdited: { effect.searchText = text; @@ -351,7 +351,7 @@ FocusScope { color: Kirigami.Theme.highlightColor visible: gridVal > 0 || nearCurrent anchors.fill: parent - property bool shouldBeVisibleInOverview: !(container.organized && effect.searchText.length > 0 && current) || heap.count !== 0 + property bool shouldBeVisibleInOverview: !(container.organized && effect.searchText.length > 0 && current) || (heap.count !== 0 && effect.filterWindows) opacity: 1 - overviewVal * (shouldBeVisibleInOverview ? 0 : 1) function selectLastItem(direction) { @@ -648,11 +648,12 @@ FocusScope { Item { width: parent.width height: parent.height - topBar.height - visible: container.organized && effect.searchText.length > 0 && allDesktopHeaps.currentHeap.count === 0 + visible: container.organized && effect.searchText.length > 0 && (allDesktopHeaps.currentHeap.count === 0 || !effect.filterWindows) opacity: overviewVal PlasmaExtras.PlaceholderMessage { id: placeholderMessage + visible: container.organized && effect.searchText.length > 0 && allDesktopHeaps.currentHeap.count === 0 && effect.filterWindows anchors.top: parent.top anchors.horizontalCenter: parent.horizontalCenter text: i18ndc("kwin", "@info:placeholder", "No matching windows") @@ -663,7 +664,7 @@ FocusScope { anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter width: parent.width / 2 - height: parent.height - placeholderMessage.height - Kirigami.Units.largeSpacing + height: effect.filterWindows ? parent.height - placeholderMessage.height - Kirigami.Units.largeSpacing : parent.height - Kirigami.Units.largeSpacing queryString: effect.searchText onActivated: {