effects/windowview+overview: get back option to hide minimized windows

Option to hide minimized windows as old present windows effect had.

BUG: 441627
BUG: 453426
FIXED-IN: 5.25
This commit is contained in:
Marco Martin 2022-05-06 15:48:41 +00:00 committed by Nate Graham
parent d5dad1b471
commit eca9b5047a
12 changed files with 73 additions and 9 deletions

View file

@ -12,7 +12,7 @@
<x>0</x>
<y>0</y>
<width>455</width>
<height>177</height>
<height>201</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
@ -37,7 +37,7 @@
</item>
</widget>
</item>
<item row="2" column="0" colspan="2">
<item row="3" column="0" colspan="2">
<widget class="KShortcutsEditor" name="shortcutsEditor">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@ -45,9 +45,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="actionTypes">
<enum>KShortcutsEditor::GlobalAction</enum>
</property>
</widget>
</item>
<item row="1" column="0">
@ -60,6 +57,20 @@
<item row="1" column="1">
<widget class="QCheckBox" name="kcfg_BlurBackground"/>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="kcfg_IgnoreMinimized">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Ignore minimized windows:</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>

View file

@ -13,6 +13,9 @@
<entry name="LayoutMode" type="Int">
<default>1</default>
</entry>
<entry name="IgnoreMinimized" type="bool">
<default>false</default>
</entry>
<entry name="BlurBackground" type="Bool">
<default>true</default>

View file

@ -153,6 +153,11 @@ int OverviewEffect::layout() const
return m_layout;
}
bool OverviewEffect::ignoreMinimized() const
{
return OverviewConfig::ignoreMinimized();
}
void OverviewEffect::setLayout(int layout)
{
if (m_layout != layout) {

View file

@ -16,6 +16,7 @@ class OverviewEffect : public QuickSceneEffect
Q_OBJECT
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 blurBackground READ blurBackground NOTIFY blurBackgroundChanged)
Q_PROPERTY(qreal partialActivationFactor READ partialActivationFactor NOTIFY partialActivationFactorChanged)
// More efficient from a property binding pov rather than binding to partialActivationFactor !== 0
@ -33,6 +34,8 @@ public:
int layout() const;
void setLayout(int layout);
bool ignoreMinimized() const;
int animationDuration() const;
void setAnimationDuration(int duration);
@ -53,6 +56,7 @@ Q_SIGNALS:
void blurBackgroundChanged();
void partialActivationFactorChanged();
void gestureInProgressChanged();
void ignoreMinimizedChanged();
public Q_SLOTS:
void activate();

View file

@ -201,6 +201,7 @@ FocusScope {
desktop: KWinComponents.Workspace.currentVirtualDesktop
screenName: targetScreen.name
clientModel: stackModel
minimizedWindows: !effect.ignoreMinimized
windowType: ~KWinComponents.ClientFilterModel.Dock &
~KWinComponents.ClientFilterModel.Desktop &
~KWinComponents.ClientFilterModel.Notification;

View file

@ -45,13 +45,14 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="actionTypes">
<enum>KShortcutsEditor::GlobalAction</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="kcfg_BlurBackground"/>
<widget class="QCheckBox" name="kcfg_IgnoreMinimized">
<property name="text">
<string>Ignore &amp;minimized windows</string>
</property>
</widget>
</item>
</layout>
</widget>

View file

@ -115,6 +115,7 @@ Item {
screenName: targetScreen.name
clientModel: stackModel
filter: searchField.text
minimizedWindows: !effect.ignoreMinimized
windowType: ~KWinComponents.ClientFilterModel.Dock &
~KWinComponents.ClientFilterModel.Desktop &
~KWinComponents.ClientFilterModel.Notification;

View file

@ -13,6 +13,9 @@
<entry name="LayoutMode" type="Int">
<default>1</default>
</entry>
<entry name="IgnoreMinimized" type="bool">
<default>false</default>
</entry>
<entry name="BorderActivate" type="IntList" />
<entry name="BorderActivateAll" type="IntList">

View file

@ -167,6 +167,11 @@ void WindowViewEffect::setLayout(int layout)
}
}
bool WindowViewEffect::ignoreMinimized() const
{
return WindowViewConfig::ignoreMinimized();
}
int WindowViewEffect::requestedEffectChainPosition() const
{
return 70;

View file

@ -20,6 +20,7 @@ class WindowViewEffect : public QuickSceneEffect
Q_OBJECT
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(PresentWindowsMode mode READ mode NOTIFY modeChanged)
Q_PROPERTY(qreal partialActivationFactor READ partialActivationFactor NOTIFY partialActivationFactorChanged)
Q_PROPERTY(bool gestureInProgress READ gestureInProgress NOTIFY gestureInProgressChanged)
@ -48,6 +49,8 @@ public:
int layout() const;
void setLayout(int layout);
bool ignoreMinimized() const;
void reconfigure(ReconfigureFlags) override;
int requestedEffectChainPosition() const override;
@ -72,6 +75,7 @@ Q_SIGNALS:
void gestureInProgressChanged();
void modeChanged();
void layoutChanged();
void ignoreMinimizedChanged();
protected:
QVariantMap initialProperties(EffectScreen *screen) override;

View file

@ -226,6 +226,22 @@ void ClientFilterModel::resetWindowType()
}
}
void ClientFilterModel::setMinimizedWindows(bool show)
{
if (m_showMinimizedWindows == show) {
return;
}
m_showMinimizedWindows = show;
invalidateFilter();
Q_EMIT minimizedWindowsChanged();
}
bool ClientFilterModel::minimizedWindows() const
{
return m_showMinimizedWindows;
}
bool ClientFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{
if (!m_clientModel) {
@ -288,6 +304,10 @@ bool ClientFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourc
}
return false;
}
if (!m_showMinimizedWindows) {
return !client->isMinimized();
}
return true;
}

View file

@ -59,6 +59,7 @@ class ClientFilterModel : public QSortFilterProxyModel
Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged)
Q_PROPERTY(QString screenName READ screenName WRITE setScreenName RESET resetScreenName NOTIFY screenNameChanged)
Q_PROPERTY(WindowTypes windowType READ windowType WRITE setWindowType RESET resetWindowType NOTIFY windowTypeChanged)
Q_PROPERTY(bool minimizedWindows READ minimizedWindows WRITE setMinimizedWindows NOTIFY minimizedWindowsChanged)
public:
enum WindowType {
@ -96,6 +97,9 @@ public:
void setWindowType(WindowTypes windowType);
void resetWindowType();
void setMinimizedWindows(bool show);
bool minimizedWindows() const;
protected:
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
@ -106,6 +110,7 @@ Q_SIGNALS:
void clientModelChanged();
void filterChanged();
void windowTypeChanged();
void minimizedWindowsChanged();
private:
WindowTypes windowTypeMask(Window *client) const;
@ -116,6 +121,7 @@ private:
QPointer<VirtualDesktop> m_desktop;
QString m_filter;
std::optional<WindowTypes> m_windowType;
bool m_showMinimizedWindows = true;
};
} // namespace ScriptingModels::V3