waybar integration: emit an array of classses rather than a single class (#103)
* emit an array of classses rather than a single class turns out waybar doesn't like: "class": "foo bar" intead it wants: "class": ["foo", "bar"] * only print once
This commit is contained in:

committed by
GitHub

parent
f7b8d67987
commit
d95e84a499
@@ -62,15 +62,20 @@ private void print_subscribe () {
|
||||
|
||||
private void on_subscribe_waybar (uint count, bool dnd, bool cc_open) {
|
||||
string state = (dnd ? "dnd-" : "") + (count > 0 ? "notification" : "none");
|
||||
if (cc_open) state += " cc-open";
|
||||
|
||||
string tooltip = "";
|
||||
if (count > 0) {
|
||||
tooltip = @"$(count) Notification" + (count > 1 ? "s" : "");
|
||||
}
|
||||
|
||||
print ("{\"text\": \"\", \"alt\": \"%s\", \"tooltip\": \"%s\", \"class\": \"%s\"}\n",
|
||||
state, tooltip, state);
|
||||
string _class = @"\"$(state)\"";
|
||||
if (cc_open) {
|
||||
_class = @"[$(_class), \"cc-open\"]";
|
||||
}
|
||||
|
||||
print (
|
||||
"{\"text\": \"\", \"alt\": \"%s\", \"tooltip\": \"%s\", \"class\": %s}\n",
|
||||
state, tooltip, _class);
|
||||
}
|
||||
|
||||
private void print_subscribe_waybar () {
|
||||
|
Reference in New Issue
Block a user