diff options
author | Ian Fan <ianfan0@gmail.com> | 2018-12-06 12:51:52 +0000 |
---|---|---|
committer | Ian Fan <ianfan0@gmail.com> | 2018-12-31 20:40:18 +0000 |
commit | 746600e6ed562db9395ac790b7749624006d80ad (patch) | |
tree | 2eee23a13139295d9438d9224a645af80291be4f /include/swaybar/tray | |
parent | swaybar: add StatusNotifierWatcher to tray (diff) | |
download | sway-746600e6ed562db9395ac790b7749624006d80ad.tar.gz sway-746600e6ed562db9395ac790b7749624006d80ad.tar.zst sway-746600e6ed562db9395ac790b7749624006d80ad.zip |
swaybar: implement icon themes and lookup for tray
Diffstat (limited to 'include/swaybar/tray')
-rw-r--r-- | include/swaybar/tray/icon.h | 44 | ||||
-rw-r--r-- | include/swaybar/tray/tray.h | 4 |
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 @@ | |||
1 | #ifndef _SWAYBAR_TRAY_ICON_H | ||
2 | #define _SWAYBAR_TRAY_ICON_H | ||
3 | |||
4 | #include "list.h" | ||
5 | |||
6 | enum subdir_type { | ||
7 | THRESHOLD, | ||
8 | SCALABLE, | ||
9 | FIXED | ||
10 | }; | ||
11 | |||
12 | struct icon_theme_subdir { | ||
13 | char *name; | ||
14 | int size; | ||
15 | enum subdir_type type; | ||
16 | int max_size; | ||
17 | int min_size; | ||
18 | int threshold; | ||
19 | }; | ||
20 | |||
21 | struct icon_theme { | ||
22 | char *name; | ||
23 | char *comment; | ||
24 | char *inherits; | ||
25 | list_t *directories; // char * | ||
26 | |||
27 | char *dir; | ||
28 | list_t *subdirs; // struct icon_theme_subdir * | ||
29 | }; | ||
30 | |||
31 | void init_themes(list_t **themes, list_t **basedirs); | ||
32 | void finish_themes(list_t *themes, list_t *basedirs); | ||
33 | |||
34 | /* | ||
35 | * Finds an icon of a specified size given a list of themes and base directories. | ||
36 | * If the icon is found, the pointers min_size & max_size are set to minimum & | ||
37 | * maximum size that the icon can be scaled to, respectively. | ||
38 | * Returns: path of icon (which should be freed), or NULL if the icon is not found. | ||
39 | */ | ||
40 | char *find_icon(list_t *themes, list_t *basedirs, char *name, int size, | ||
41 | char *theme, int *min_size, int *max_size); | ||
42 | char *find_icon_in_dir(char *name, char *dir, int *min_size, int *max_size); | ||
43 | |||
44 | #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 @@ | |||
9 | #endif | 9 | #endif |
10 | #include <cairo.h> | 10 | #include <cairo.h> |
11 | #include <stdint.h> | 11 | #include <stdint.h> |
12 | #include "list.h" | ||
12 | 13 | ||
13 | struct swaybar; | 14 | struct swaybar; |
14 | struct swaybar_output; | 15 | struct swaybar_output; |
@@ -22,6 +23,9 @@ struct swaybar_tray { | |||
22 | 23 | ||
23 | struct swaybar_watcher *watcher_xdg; | 24 | struct swaybar_watcher *watcher_xdg; |
24 | struct swaybar_watcher *watcher_kde; | 25 | struct swaybar_watcher *watcher_kde; |
26 | |||
27 | list_t *basedirs; // char * | ||
28 | list_t *themes; // struct swaybar_theme * | ||
25 | }; | 29 | }; |
26 | 30 | ||
27 | struct swaybar_tray *create_tray(struct swaybar *bar); | 31 | struct swaybar_tray *create_tray(struct swaybar *bar); |