diff --git a/data/css/default.css b/data/css/default.css index d0bb26f06..e8b1e9090 100644 --- a/data/css/default.css +++ b/data/css/default.css @@ -26,6 +26,13 @@ background-color: #8883; } +.wf-panel .tray flowboxchild { + background: transparent; + border: none; + box-shadow: none; + padding: 0; +} + .wf-panel .window-button:hover { background-color: #8882; } diff --git a/src/panel/widgets/tray/item.cpp b/src/panel/widgets/tray/item.cpp index 8723b0c13..9adc0cd31 100644 --- a/src/panel/widgets/tray/item.cpp +++ b/src/panel/widgets/tray/item.cpp @@ -282,27 +282,57 @@ std::string StatusNotifierItem::get_unique_name() } /* - * DBUS names are in the format of :1.61 - * I have no idea what this means, I frankly don't care, but I need a way to generate an acceptable action - * group name from this - * such that it always gets the same unique output for the same input + * Turn DBUS names into a partial action name, to correctly namespace different tray items */ - -const std::string CHARS_IN = ":0123456789."; -const std::string CHARS_OUT = "zabcdefghijk"; std::string StatusNotifierItem::dbus_name_as_prefix() { - std::unordered_map map; - for (int i = 0; i < (int)CHARS_IN.length(); i++) + assert(!dbus_name.empty() && + "StatusNotifierItem::dbus_name cannot be empty when generating action prefix"); + std::stringstream ss; + if (dbus_name[0] == ':') { - map[CHARS_IN[i]] = CHARS_OUT[i]; + const std::string CHARS_IN = ":0123456789."; + const std::string CHARS_OUT = "zabcdefghijk"; + + std::unordered_map map; + for (size_t i = 0; i < CHARS_IN.length(); i++) + { + map[CHARS_IN[i]] = CHARS_OUT[i]; + } + + for (char c : dbus_name) + { + if (map.count(c)) + { + ss << map[c]; + } else + { + ss << 'l'; + } + } + } else + { + /* Cover well-known paths */ + for (char c : dbus_name) + { + if (((c >= 'a') && (c <= 'z')) || + ((c >= 'A') && (c <= 'Z')) || + ((c >= '0') && (c <= '9'))) + { + ss << c; + } else + { + ss << '-'; + } + } } - std::stringstream ss; - for (int i = 0; i < (int)dbus_name.length(); i++) + std::string prefix = ss.str(); + + if (!prefix.empty() && (std::isdigit(prefix[0]) || (prefix[0] == '-'))) { - ss << map[dbus_name[i]]; + prefix = "sni-" + prefix; } - return ss.str(); + return prefix; }