Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions data/css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
58 changes: 44 additions & 14 deletions src/panel/widgets/tray/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<char, char> 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<char, char> 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;
}
Loading