aboutsummaryrefslogtreecommitdiff
path: root/include/swaybar
diff options
context:
space:
mode:
authorIan Fan <ianfan0@gmail.com>2018-12-06 12:51:52 +0000
committerIan Fan <ianfan0@gmail.com>2018-12-31 20:40:18 +0000
commit746600e6ed562db9395ac790b7749624006d80ad (patch)
tree2eee23a13139295d9438d9224a645af80291be4f /include/swaybar
parent02df3f67aad203e87602c0124489a41382994cbc (diff)
swaybar: implement icon themes and lookup for tray
Diffstat (limited to 'include/swaybar')
-rw-r--r--include/swaybar/tray/icon.h44
-rw-r--r--include/swaybar/tray/tray.h4
2 files changed, 48 insertions, 0 deletions
diff --git a/include/swaybar/tray/icon.h b/include/swaybar/tray/icon.h
new file mode 100644
index 00000000..7a6c400c
--- /dev/null
+++ b/include/swaybar/tray/icon.h
@@ -0,0 +1,44 @@
+#ifndef _SWAYBAR_TRAY_ICON_H
+#define _SWAYBAR_TRAY_ICON_H
+
+#include "list.h"
+
+enum subdir_type {
+ THRESHOLD,
+ SCALABLE,
+ FIXED
+};
+
+struct icon_theme_subdir {
+ char *name;
+ int size;
+ enum subdir_type type;
+ int max_size;
+ int min_size;
+ int threshold;
+};
+
+struct icon_theme {
+ char *name;
+ char *comment;
+ char *inherits;
+ list_t *directories; // char *
+
+ char *dir;
+ list_t *subdirs; // struct icon_theme_subdir *
+};
+
+void init_themes(list_t **themes, list_t **basedirs);
+void finish_themes(list_t *themes, list_t *basedirs);
+
+/*
+ * Finds an icon of a specified size given a list of themes and base directories.
+ * If the icon is found, the pointers min_size & max_size are set to minimum &
+ * maximum size that the icon can be scaled to, respectively.
+ * Returns: path of icon (which should be freed), or NULL if the icon is not found.
+ */
+char *find_icon(list_t *themes, list_t *basedirs, char *name, int size,
+ char *theme, int *min_size, int *max_size);
+char *find_icon_in_dir(char *name, char *dir, int *min_size, int *max_size);
+
+#endif
diff --git a/include/swaybar/tray/tray.h b/include/swaybar/tray/tray.h
index cc3e8133..8e15fb86 100644
--- a/include/swaybar/tray/tray.h
+++ b/include/swaybar/tray/tray.h
@@ -9,6 +9,7 @@
#endif
#include <cairo.h>
#include <stdint.h>
+#include "list.h"
struct swaybar;
struct swaybar_output;
@@ -22,6 +23,9 @@ struct swaybar_tray {
struct swaybar_watcher *watcher_xdg;
struct swaybar_watcher *watcher_kde;
+
+ list_t *basedirs; // char *
+ list_t *themes; // struct swaybar_theme *
};
struct swaybar_tray *create_tray(struct swaybar *bar);