From 92452d60b51e0fbca16765a1a01f99144354aa93 Mon Sep 17 00:00:00 2001 From: Boris Ivanov Date: Thu, 22 Oct 2026 18:26:31 -0400 Subject: [PATCH] tray: keep the action prefix valid for well-known bus names dbus_name_as_prefix() only maps ':', digits and '.'; every other character became '\0' via std::unordered_map::operator[]. Well-known names such as Electron's org.freedesktop.StatusNotifierItem-2916-1 therefore produced a prefix with NULs, the menu's actions were not found under it, and clicking a menu entry did nothing. Keep mapped characters as before, pass ASCII letters through and map anything else to 'y'. Unique names (:1.42) give the same prefix as before. Co-Authored-By: Claude Opus 5.5 --- src/panel/widgets/tray/item.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/panel/widgets/tray/item.cpp b/src/panel/widgets/tray/item.cpp index 8723b0c13..f536a0418 100644 --- a/src/panel/widgets/tray/item.cpp +++ b/src/panel/widgets/tray/item.cpp @@ -298,10 +298,23 @@ std::string StatusNotifierItem::dbus_name_as_prefix() map[CHARS_IN[i]] = CHARS_OUT[i]; } + // Well-known names (e.g. Electron's "org.freedesktop.StatusNotifierItem-2916-1") contain + // letters and '-', which map[] doesn't cover: map[c] would insert '\0' and the prefix + // would no longer match the inserted action group, so menu clicks did nothing. std::stringstream ss; for (int i = 0; i < (int)dbus_name.length(); i++) { - ss << map[dbus_name[i]]; + const char c = dbus_name[i]; + if (map.count(c)) + { + ss << map[c]; + } else if (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'))) + { + ss << c; + } else + { + ss << 'y'; + } } return ss.str();