service/tray: support /NO_DBUSMENU as a marker for absence of a menu

I couldn't find any documentation for this, but it was requested and
KDE also does it.
This commit is contained in:
outfoxxed committed 2026-08-25 23:03:30 -07:00
1 parent 9f59d0a05d
commit 39e14d3627
1 file changed
+10 -3
+10 -3
View File
@@ -103,7 +103,12 @@ StatusNotifierItem::StatusNotifierItem(const QString& address, QObject* parent)
return this->imageHandle.url() % "/" % QString::number(this->pixmapIndex);
});
this->bHasMenu.setBinding([this]() { return !this->bMenuPath.value().path().isEmpty(); });
this->bHasMenu.setBinding([this]() {
// Could not find any documentation about No_DBUSMENU but KDE checks for it
// and it was requested.
return !this->bMenuPath.value().path().isEmpty()
&& this->bMenuPath.value().path() != "/NO_DBUSMENU";
});
QObject::connect(
this->item,
@@ -270,11 +275,13 @@ void StatusNotifierItem::scroll(qint32 delta, bool horizontal) const {
void StatusNotifierItem::updatePixmapIndex() { this->pixmapIndex = this->pixmapIndex + 1; }
DBusMenuHandle* StatusNotifierItem::menuHandle() {
return this->bMenuPath.value().path().isEmpty() ? nullptr : &this->mMenuHandle;
return !this->bHasMenu ? nullptr : &this->mMenuHandle;
}
void StatusNotifierItem::onMenuPathChanged() {
this->mMenuHandle.setAddress(this->item->service(), this->bMenuPath.value().path());
auto path = this->bMenuPath.value().path();
if (!this->bHasMenu) path = "";
this->mMenuHandle.setAddress(this->item->service(), path);
}
void StatusNotifierItem::onGetAllFinished() {