mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-22 20:25:39 +02:00
Introduce a new icon particle. It follows the icon spec (https://specifications.freedesktop.org/icon-theme-spec/latest/index.html). Rendering logic is taken from fuzzel (using nanosvg + libpng), while loading logic is taken from sway. Standard usage is with `use-tag = false` which expands the provided string template and then loads the string as the icon name. There are settings to manually override the base paths, themes, etc. The second usage which is required for tray support is a special icon tag that transfers raw pixmaps. With `use-tag = true` it first expands the string, and then uses that output to find an icon pixmap tag. To reduce memory usage, themes are reference counted so they can be passed down the configuration stack without having to load them in multiple times. For programmability, a fallback particle can be specified if no icon/tag is found `fallback: ...`. And the new icon pixmap tag can be existence checked in map conditions using `+{tag_name}`. Future work to be done in follow up diffs: 1. Icon caching. Currently performs an icon lookup on each instantiation & a render on each refresh. 2. Theme caching. Changing theme directories results in a new "theme collection" being created resulting in the possibility of duplicated theme loading.
55 lines
1.1 KiB
C
55 lines
1.1 KiB
C
#pragma once
|
|
|
|
#include "../bar/bar.h"
|
|
#include "backend.h"
|
|
|
|
struct private
|
|
{
|
|
/* From bar_config */
|
|
char *monitor;
|
|
enum bar_layer layer;
|
|
enum bar_location location;
|
|
struct basedirs *basedirs;
|
|
struct themes *themes;
|
|
int height;
|
|
int left_spacing, right_spacing;
|
|
int left_margin, right_margin;
|
|
int trackpad_sensitivity;
|
|
|
|
pixman_color_t background;
|
|
|
|
struct {
|
|
int left_width, right_width;
|
|
int top_width, bottom_width;
|
|
pixman_color_t color;
|
|
int left_margin, right_margin;
|
|
int top_margin, bottom_margin;
|
|
} border;
|
|
|
|
struct {
|
|
struct module **mods;
|
|
struct exposable **exps;
|
|
size_t count;
|
|
} left;
|
|
struct {
|
|
struct module **mods;
|
|
struct exposable **exps;
|
|
size_t count;
|
|
} center;
|
|
struct {
|
|
struct module **mods;
|
|
struct exposable **exps;
|
|
size_t count;
|
|
} right;
|
|
|
|
/* Calculated run-time */
|
|
int width;
|
|
int height_with_border;
|
|
|
|
pixman_image_t *pix;
|
|
|
|
struct {
|
|
void *data;
|
|
const struct backend *iface;
|
|
} backend;
|
|
};
|