Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Hide multitask button when composition is disabled #282

Merged
merged 2 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion panels/dock/multitaskview/multitaskview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
#include "pluginfactory.h"

#include <DDBusSender>
#include <DWindowManagerHelper>

DGUI_USE_NAMESPACE

namespace dock {

MultiTaskView::MultiTaskView(QObject *parent)
: DApplet(parent)
, m_iconName("deepin-multitasking-view")
{

connect(DWindowManagerHelper::instance(), &DWindowManagerHelper::hasCompositeChanged, this, &MultiTaskView::compositeStateChanged);
}

bool MultiTaskView::init()
Expand Down Expand Up @@ -46,6 +49,11 @@ void MultiTaskView::setIconName(const QString& iconName)
}
}

bool MultiTaskView::hasComposite()
{
return DWindowManagerHelper::instance()->hasComposite();
}

D_APPLET_CLASS(MultiTaskView)
}

Expand Down
3 changes: 3 additions & 0 deletions panels/dock/multitaskview/multitaskview.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@ class MultiTaskView : public DS_NAMESPACE::DApplet
{
Q_OBJECT
Q_PROPERTY(QString iconName READ iconName WRITE setIconName NOTIFY iconNameChanged FINAL)
Q_PROPERTY(bool hasComposite READ hasComposite NOTIFY compositeStateChanged)
public:
explicit MultiTaskView(QObject *parent = nullptr);
virtual bool init() override;

QString iconName() const;
void setIconName(const QString& iconName);
bool hasComposite();

Q_INVOKABLE void openWorkspace();

Q_SIGNALS:
void iconNameChanged();
void compositeStateChanged();

private:
QString m_iconName;
Expand Down
1 change: 1 addition & 0 deletions panels/dock/multitaskview/package/multitaskview.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ AppletItem {
id: toggleworkspace
property bool useColumnLayout: Panel.position % 2
property int dockOrder: 13
property bool shouldVisible: Applet.hasComposite
// 1:4 the distance between app : dock height; get width/height≈0.8
implicitWidth: useColumnLayout ? Panel.rootObject.dockSize : Panel.rootObject.dockItemMaxSize * 0.8
implicitHeight: useColumnLayout ? Panel.rootObject.dockItemMaxSize * 0.8 : Panel.rootObject.dockSize
Expand Down
Loading