diff options
author | 2017-10-25 12:49:34 -0600 | |
---|---|---|
committer | 2017-12-29 12:11:51 -0700 | |
commit | 4231061e4d80a19a6f2dde0bfb63b7a7b277bd4a (patch) | |
tree | ca5a21c04d5f30aeb156f5ef2541a2c667861652 /swaybar/tray | |
parent | Allow paths to icons in iconName property (diff) | |
download | sway-4231061e4d80a19a6f2dde0bfb63b7a7b277bd4a.tar.gz sway-4231061e4d80a19a6f2dde0bfb63b7a7b277bd4a.tar.zst sway-4231061e4d80a19a6f2dde0bfb63b7a7b277bd4a.zip |
Allow multiple object paths for each connection
Diffstat (limited to 'swaybar/tray')
-rw-r--r-- | swaybar/tray/sni.c | 11 | ||||
-rw-r--r-- | swaybar/tray/tray.c | 7 |
2 files changed, 16 insertions, 2 deletions
diff --git a/swaybar/tray/sni.c b/swaybar/tray/sni.c index 44d7ad91..7e09f414 100644 --- a/swaybar/tray/sni.c +++ b/swaybar/tray/sni.c | |||
@@ -484,6 +484,17 @@ int sni_uniq_cmp(const void *_item, const void *_str) { | |||
484 | } | 484 | } |
485 | return strcmp(item->unique_name, str); | 485 | return strcmp(item->unique_name, str); |
486 | } | 486 | } |
487 | int sni_obj_name_cmp(const void *_item, const void *_obj_name) { | ||
488 | const struct StatusNotifierItem *item = _item; | ||
489 | const struct ObjName *obj_name = _obj_name; | ||
490 | |||
491 | if (strcmp(item->name, obj_name->name) == 0 && | ||
492 | strcmp(item->object_path, obj_name->obj_path) == 0) { | ||
493 | return 0; | ||
494 | } | ||
495 | return 1; | ||
496 | } | ||
497 | |||
487 | void sni_free(struct StatusNotifierItem *item) { | 498 | void sni_free(struct StatusNotifierItem *item) { |
488 | if (!item) { | 499 | if (!item) { |
489 | return; | 500 | return; |
diff --git a/swaybar/tray/tray.c b/swaybar/tray/tray.c index 01532e1c..5cc7e902 100644 --- a/swaybar/tray/tray.c +++ b/swaybar/tray/tray.c | |||
@@ -291,8 +291,11 @@ static DBusHandlerResult signal_handler(DBusConnection *connection, | |||
291 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | 291 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; |
292 | } | 292 | } |
293 | 293 | ||
294 | // TODO allow one unique name to have multiple items | 294 | struct ObjName obj_name = { |
295 | if (list_seq_find(tray->items, sni_str_cmp, unique_name) == -1) { | 295 | object_path, |
296 | unique_name, | ||
297 | }; | ||
298 | if (list_seq_find(tray->items, sni_obj_name_cmp, &obj_name) == -1) { | ||
296 | struct StatusNotifierItem *item = | 299 | struct StatusNotifierItem *item = |
297 | sni_create_from_obj_path(unique_name, | 300 | sni_create_from_obj_path(unique_name, |
298 | object_path); | 301 | object_path); |