service/tray: report misbehaving tray hosts

I've debugged broken tray items that just end up being a bad host far
too many times.
This commit is contained in:
outfoxxed 2024-11-17 01:30:54 -08:00
parent 0445eee33a
commit 36d1dbeb69
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
6 changed files with 25 additions and 2 deletions

View file

@ -47,12 +47,15 @@ StatusNotifierWatcher::StatusNotifierWatcher(QObject* parent): QObject(parent) {
this->tryRegister();
}
bool StatusNotifierWatcher::isRegistered() const { return this->registered; }
void StatusNotifierWatcher::tryRegister() { // NOLINT
auto bus = QDBusConnection::sessionBus();
auto success = bus.registerService("org.kde.StatusNotifierWatcher");
if (success) {
qCDebug(logStatusNotifierWatcher) << "Registered watcher at org.kde.StatusNotifierWatcher";
this->registered = true;
} else {
qCDebug(logStatusNotifierWatcher)
<< "Could not register watcher at org.kde.StatusNotifierWatcher, presumably because one is "
@ -68,7 +71,6 @@ void StatusNotifierWatcher::onServiceUnregistered(const QString& service) {
<< "Active StatusNotifierWatcher unregistered, attempting registration";
this->tryRegister();
return;
;
} else {
QString qualifiedItem;
this->items.removeIf([&](const QString& item) {