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
master
Dashon Wells 11 months ago committed by Nate Graham
parent e67847d43f
commit b0d8979178

@ -65,7 +65,21 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="2"> <item row="3" column="0">
<widget class="QLabel" name="label_FilterWindows">
<property name="text">
<string>Search results include filtered windows:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="kcfg_FilterWindows">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="KShortcutsEditor" name="shortcutsEditor"> <widget class="KShortcutsEditor" name="shortcutsEditor">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">

@ -16,6 +16,9 @@
<entry name="IgnoreMinimized" type="bool"> <entry name="IgnoreMinimized" type="bool">
<default>false</default> <default>false</default>
</entry> </entry>
<entry name="FilterWindows" type="bool">
<default>true</default>
</entry>
<entry name="OrganizedGrid" type="bool"> <entry name="OrganizedGrid" type="bool">
<default>true</default> <default>true</default>
</entry> </entry>

@ -168,6 +168,7 @@ void OverviewEffect::reconfigure(ReconfigureFlags)
OverviewConfig::self()->read(); OverviewConfig::self()->read();
setLayout(OverviewConfig::layoutMode()); setLayout(OverviewConfig::layoutMode());
setAnimationDuration(animationTime(300)); setAnimationDuration(animationTime(300));
setFilterWindows(OverviewConfig::filterWindows());
for (const ElectricBorder &border : std::as_const(m_borderActivate)) { for (const ElectricBorder &border : std::as_const(m_borderActivate)) {
effects->unreserveElectricBorder(border, this); 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 qreal OverviewEffect::overviewPartialActivationFactor() const
{ {
return m_overviewState->partialActivationFactor(); return m_overviewState->partialActivationFactor();

@ -18,6 +18,7 @@ class OverviewEffect : public QuickSceneEffect
Q_PROPERTY(int animationDuration READ animationDuration NOTIFY animationDurationChanged) Q_PROPERTY(int animationDuration READ animationDuration NOTIFY animationDurationChanged)
Q_PROPERTY(int layout READ layout NOTIFY layoutChanged) Q_PROPERTY(int layout READ layout NOTIFY layoutChanged)
Q_PROPERTY(bool ignoreMinimized READ ignoreMinimized NOTIFY ignoreMinimizedChanged) 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(bool organizedGrid READ organizedGrid NOTIFY organizedGridChanged)
Q_PROPERTY(qreal overviewPartialActivationFactor READ overviewPartialActivationFactor NOTIFY overviewPartialActivationFactorChanged) 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 // 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 ignoreMinimized() const;
bool organizedGrid() const; bool organizedGrid() const;
bool filterWindows() const;
void setFilterWindows(bool filterWindows);
int animationDuration() const; int animationDuration() const;
void setAnimationDuration(int duration); void setAnimationDuration(int duration);
@ -67,6 +71,7 @@ Q_SIGNALS:
void gridPartialActivationFactorChanged(); void gridPartialActivationFactorChanged();
void gridGestureInProgressChanged(); void gridGestureInProgressChanged();
void ignoreMinimizedChanged(); void ignoreMinimizedChanged();
void filterWindowsChanged();
void organizedGridChanged(); void organizedGridChanged();
void desktopOffsetChanged(); void desktopOffsetChanged();
void searchTextChanged(); void searchTextChanged();
@ -93,6 +98,7 @@ private:
QList<ElectricBorder> m_borderActivate; QList<ElectricBorder> m_borderActivate;
QString m_searchText; QString m_searchText;
QPointF m_desktopOffset; QPointF m_desktopOffset;
bool m_filterWindows = true;
int m_animationDuration = 400; int m_animationDuration = 400;
int m_layout = 1; int m_layout = 1;
}; };

@ -262,7 +262,7 @@ FocusScope {
effect.searchTextChanged() effect.searchTextChanged()
} }
Keys.priority: Keys.BeforeItem 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 text: effect.searchText
onTextEdited: { onTextEdited: {
effect.searchText = text; effect.searchText = text;
@ -351,7 +351,7 @@ FocusScope {
color: Kirigami.Theme.highlightColor color: Kirigami.Theme.highlightColor
visible: gridVal > 0 || nearCurrent visible: gridVal > 0 || nearCurrent
anchors.fill: parent 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) opacity: 1 - overviewVal * (shouldBeVisibleInOverview ? 0 : 1)
function selectLastItem(direction) { function selectLastItem(direction) {
@ -648,11 +648,12 @@ FocusScope {
Item { Item {
width: parent.width width: parent.width
height: parent.height - topBar.height 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 opacity: overviewVal
PlasmaExtras.PlaceholderMessage { PlasmaExtras.PlaceholderMessage {
id: placeholderMessage id: placeholderMessage
visible: container.organized && effect.searchText.length > 0 && allDesktopHeaps.currentHeap.count === 0 && effect.filterWindows
anchors.top: parent.top anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
text: i18ndc("kwin", "@info:placeholder", "No matching windows") text: i18ndc("kwin", "@info:placeholder", "No matching windows")
@ -663,7 +664,7 @@ FocusScope {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
width: parent.width / 2 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 queryString: effect.searchText
onActivated: { onActivated: {

Loading…
Cancel
Save