Skip to content

Commit

Permalink
fix: dock get stucked when launching
Browse files Browse the repository at this point in the history
org.ayatana.bamf dbus will get into stucked, so only call it when it's ready

log: only call org.ayatana.bamf when it's ready
issue: linuxdeepin/developer-center#6657
  • Loading branch information
tsic404 committed Jan 10, 2024
1 parent a222173 commit 31e149d
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions frame/taskmanager/windowidentify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include <QDebug>
#include <QThread>
#include <qstandardpaths.h>
#include <QDBusConnection>

#define XCB XCBUtils::instance()

Expand Down Expand Up @@ -74,11 +74,28 @@ WindowIdentify::WindowIdentify(TaskManager *_taskmanager, QObject *parent)
m_identifyWindowFuns << qMakePair(QString("FlatpakAppID"), &identifyWindowByFlatpakAppID);
m_identifyWindowFuns << qMakePair(QString("CrxId"), &identifyWindowByCrxId);
m_identifyWindowFuns << qMakePair(QString("Rule"), &identifyWindowByRule);
m_identifyWindowFuns << qMakePair(QString("Bamf"), &identifyWindowByBamf);
m_identifyWindowFuns << qMakePair(QString("Pid"), &identifyWindowByPid);
m_identifyWindowFuns << qMakePair(QString("Scratch"), &identifyWindowByScratch);
m_identifyWindowFuns << qMakePair(QString("GtkAppId"), &identifyWindowByGtkAppId);
m_identifyWindowFuns << qMakePair(QString("WmClass"), &identifyWindowByWmClass);

// should remove bamf identify and turn to new AM
auto *dbusWatcher = new QDBusServiceWatcher(QStringLiteral("org.ayatana.bamf"), QDBusConnection::sessionBus(),
QDBusServiceWatcher::WatchForOwnerChange, this);

auto ifc = QDBusConnection::sessionBus().interface();

if (ifc->isServiceRegistered(QStringLiteral("org.ayatana.bamf"))) {
m_identifyWindowFuns << qMakePair(QString("Bamf"), &identifyWindowByBamf);
}

connect(dbusWatcher, &QDBusServiceWatcher::serviceRegistered, this, [this](){
m_identifyWindowFuns << qMakePair(QString("Bamf"), &identifyWindowByBamf);
});

connect(dbusWatcher, &QDBusServiceWatcher::serviceUnregistered, this, [this](){
m_identifyWindowFuns.removeAll(qMakePair(QString("Bamf"), &identifyWindowByBamf));
});
}

AppInfo *WindowIdentify::identifyWindow(WindowInfoBase *winInfo, QString &innerId)
Expand Down

0 comments on commit 31e149d

Please sign in to comment.