aboutsummaryrefslogtreecommitdiff
path: root/swaybar/tray/icon.c
diff options
context:
space:
mode:
authorIan Fan <ianfan0@gmail.com>2019-06-15 08:58:24 +0100
committerSimon Ser <contact@emersion.fr>2020-03-30 17:31:00 +0200
commit3b894c387dc38e8715186d5c0171b6048b36c435 (patch)
treee562ef9007dbe4fc9f4364830211583e85a1b457 /swaybar/tray/icon.c
parent66f0c91bb846472a8fb5edb2dde1b67f3a636ccf (diff)
tray: allow themes to inherit from multiple themes
Diffstat (limited to 'swaybar/tray/icon.c')
-rw-r--r--swaybar/tray/icon.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/swaybar/tray/icon.c b/swaybar/tray/icon.c
index 9c62911d..69df3582 100644
--- a/swaybar/tray/icon.c
+++ b/swaybar/tray/icon.c
@@ -69,7 +69,7 @@ static void destroy_theme(struct icon_theme *theme) {
}
free(theme->name);
free(theme->comment);
- free(theme->inherits);
+ list_free_items_and_destroy(theme->inherits);
list_free_items_and_destroy(theme->directories);
free(theme->dir);
@@ -149,7 +149,7 @@ static const char *entry_handler(char *group, char *key, char *value,
} else if (strcmp(key, "Comment") == 0) {
theme->comment = strdup(value);
} else if (strcmp(key, "Inherits") == 0) {
- theme->inherits = strdup(value);
+ theme->inherits = split_string(value, ",");
} else if (strcmp(key, "Directories") == 0) {
theme->directories = split_string(value, ",");
} // Ignored: ScaledDirectories, Hidden, Example
@@ -496,8 +496,13 @@ static char *find_icon_with_theme(list_t *basedirs, list_t *themes, char *name,
}
if (!icon && theme->inherits) {
- icon = find_icon_with_theme(basedirs, themes, name, size,
- theme->inherits, min_size, max_size);
+ for (int i = 0; i < theme->inherits->length; ++i) {
+ icon = find_icon_with_theme(basedirs, themes, name, size,
+ theme->inherits->items[i], min_size, max_size);
+ if (icon) {
+ break;
+ }
+ }
}
return icon;