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 | 4a3ada303b948ce2bdf21c7e6254005c85b000ea (diff) | |
parent | 9e31f5d79ce9de8f1c73013b792aa94f355a1983 (diff) |
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 @@ -#ifndef _SWAYBAR_ICON_H -#define _SWAYBAR_ICON_H +#ifndef _SWAYBAR_TRAY_ICON_H +#define _SWAYBAR_TRAY_ICON_H -#include <stdint.h> -#include <stdbool.h> -#include <client/cairo.h> +#include "list.h" -/** - * Returns the image found by `name` that is closest to `size` - */ -cairo_surface_t *find_icon(const char *name, int size); +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 * -/* Struct used internally only */ -struct subdir; + 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 /* _SWAYBAR_ICON_H */ +#endif |