Skip to content

Conversation

@UtkarshVerma
Copy link

This commit implements customColor styling for SVG icons using librsvg. This is a rebased version of #1081 as master had changed quite a lot from that branch.

This commit implements customColor styling for SVG icons using librsvg.
@bynect
Copy link
Contributor

bynect commented Oct 11, 2025

could this possibly be tweaked to allow a svg_stylesheet instead of just the color?

@UtkarshVerma
Copy link
Author

UtkarshVerma commented Oct 12, 2025

I have implemented a version with a bit of templating as well. Please have a look. For now, it defaults to path: { fill: @foreground !important; }. I also allow the user to use @foreground and @background so that the color vary based on the active notification.

This is how the defaults look for me, for example.

image

Also, for the tests, I think librsvg needs to be added to the CI docker images.

@bynect
Copy link
Contributor

bynect commented Oct 12, 2025

Also, for the tests, I think librsvg needs to be added to the CI docker images

you are right I will do so

@bynect
Copy link
Contributor

bynect commented Oct 12, 2025

this seems to be a problem with librsvg itself?

@UtkarshVerma
Copy link
Author

All tests pass for me. make test-valgrind reports some errors but they are also the on master so I doubt it is from this PR.

@UtkarshVerma
Copy link
Author

How should I proceed with this PR?

@bynect
Copy link
Contributor

bynect commented Oct 16, 2025

The code seems good and I have no clue why the build is failing. It seems like the library includes are wrong??

@UtkarshVerma
Copy link
Author

It couldn't be the library includes. As I've stated before, make test-valgrind fails on master without my changes.

@bynect
Copy link
Contributor

bynect commented Oct 17, 2025

make test and make test-valgrind work normally for me on master. you might just have some messed up library version.
what the ci is failing on is the build step:

pod2man --name=dunst -c "Dunst Reference" --section=1 --release="v1.13.0-16-g95321a8" docs/dunst.1.pod > docs/dunst.1
src/icon.c:236:17: error: implicit declaration of function 'rsvg_handle_set_stylesheet' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                rsvg_handle_set_stylesheet(handle, (guint8 *)resolved_css, strlen(resolved_css), &error);
                ^
In file included from test/icon.c:1:
test/../src/icon.c:236:17: error: implicit declaration of function 'rsvg_handle_set_stylesheet' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                rsvg_handle_set_stylesheet(handle, (guint8 *)resolved_css, strlen(resolved_css), &error);
                ^
src/icon.c:236:17: note: did you mean 'rsvg_handle_get_type'?
test/../src/icon.c:236:17: note: did you mean 'rsvg_handle_get_type'?
/usr/include/librsvg-2.0/librsvg/rsvg.h:53:7: note: 'rsvg_handle_get_type' declared here
GType rsvg_handle_get_type (void);
      ^
/usr/include/librsvg-2.0/librsvg/rsvg.h:53:7: note: 'rsvg_handle_get_type' declared here
GType rsvg_handle_get_type (void);
      ^
In file included from src/icon.c:239:30: error: expected ';' after expression
                RsvgRectangle viewport = {
                             ^
                             ;
src/icon.c:239:17: error: use of undeclared identifier 'RsvgRectangle'
                RsvgRectangle viewport = {
                ^
test/icon.c:1:
test/../src/icon.c:239:30: error: expected ';' after expression
                RsvgRectangle viewport = {
                             ^
                             ;
test/../src/icon.c:239:17: error: use of undeclared identifier 'RsvgRectangle'
                RsvgRectangle viewport = {
                ^
test/../src/icon.c:239:31: error: use of undeclared identifier 'viewport'
                RsvgRectangle viewport = {
                              ^
test/../src/icon.c:239:42: error: expected expression
                RsvgRectangle viewport = {
                                         ^
test/../src/icon.c:245:17: error: implicit declaration of function 'rsvg_handle_render_document' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                rsvg_handle_render_document(handle, cr, &viewport, &error);
                ^
src/icon.c:239:31: error: use of undeclared identifier 'viewport'
                RsvgRectangle viewport = {
                              ^
src/icon.c:239:42: error: expected expression
                RsvgRectangle viewport = {
                                         ^
src/icon.c:245:17: error: implicit declaration of function 'rsvg_handle_render_document' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                rsvg_handle_render_document(handle, cr, &viewport, &error);
                ^
clang -o dunstify dunstify.o -g -std=gnu11 -pedantic -Wall -Wno-overlength-strings -Os -Werror     -pthread -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lm -lrt  -lnotify -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
src/icon.c:245:17: note: did you mean 'rsvg_handle_render_cairo'?
/usr/include/librsvg-2.0/librsvg/rsvg-cairo.h:37:13: note: 'rsvg_handle_render_cairo' declared here
gboolean    rsvg_handle_render_cairo     (RsvgHandle * handle, cairo_t * cr);
            ^
src/icon.c:245:58: error: use of undeclared identifier 'viewport'
                rsvg_handle_render_document(handle, cr, &viewport, &error);
                                                         ^
test/../src/icon.c:245:17: note: did you mean 'rsvg_handle_render_cairo'?
/usr/include/librsvg-2.0/librsvg/rsvg-cairo.h:37:13:7 errors generated.
 note: 'rsvg_handle_render_cairo' declared here
gboolean    rsvg_handle_render_cairo     (RsvgHandle * handle, cairo_t * cr);
            ^
In file included from test/icon.c:1:
test/../src/icon.c:245:58: error: use of undeclared identifier 'viewport'
                rsvg_handle_render_document(handle, cr, &viewport, &error);
                                                         ^
make: *** [Makefile:85: src/icon.o] Error 1
make: *** Waiting for unfinished jobs....
7 errors generated.
make: *** [Makefile:125: test/icon.o] Error 1

is this an old version of rsvg ? or an upstream bug? i never used the library myself so I can't tell at a glance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants