diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-12-31 15:43:23 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-31 15:43:23 -0500 |
commit | 3d7c20f062bebe39199d3872e5b64d5e8d61d100 (patch) | |
tree | 93b8ddb51873cae14db8d5f07db74ca96236f184 /include/swaybar/tray/icon.h | |
parent | Apply implicit fallback seat config (diff) | |
parent | swaybar: use KDE's SNI IconThemePath property (diff) | |
download | sway-3d7c20f062bebe39199d3872e5b64d5e8d61d100.tar.gz sway-3d7c20f062bebe39199d3872e5b64d5e8d61d100.tar.zst sway-3d7c20f062bebe39199d3872e5b64d5e8d61d100.zip |
Merge pull request #3249 from ianyfan/tray
Swaybar tray
Diffstat (limited to 'include/swaybar/tray/icon.h')
-rw-r--r-- | include/swaybar/tray/icon.h | 52 |
1 files changed, 40 insertions, 12 deletions
diff --git a/include/swaybar/tray/icon.h b/include/swaybar/tray/icon.h index 1cc6ff9c..7a6c400c 100644 --- a/include/swaybar/tray/icon.h +++ b/include/swaybar/tray/icon.h | |||
@@ -1,16 +1,44 @@ | |||
1 | #ifndef _SWAYBAR_ICON_H | 1 | #ifndef _SWAYBAR_TRAY_ICON_H |
2 | #define _SWAYBAR_ICON_H | 2 | #define _SWAYBAR_TRAY_ICON_H |
3 | 3 | ||
4 | #include <stdint.h> | 4 | #include "list.h" |
5 | #include <stdbool.h> | ||
6 | #include <client/cairo.h> | ||
7 | 5 | ||
8 | /** | 6 | enum subdir_type { |
9 | * Returns the image found by `name` that is closest to `size` | 7 | THRESHOLD, |
10 | */ | 8 | SCALABLE, |
11 | cairo_surface_t *find_icon(const char *name, int size); | 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 * | ||
12 | 26 | ||
13 | /* Struct used internally only */ | 27 | char *dir; |
14 | struct subdir; | 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); | ||
15 | 43 | ||
16 | #endif /* _SWAYBAR_ICON_H */ | 44 | #endif |