Skip to content

How to include custom icons in a Relm4 app? #496

Answered by chriskilding
chriskilding asked this question in Q&A
Discussion options

You must be logged in to vote

This is a Cargo-only approach to including resources (like icons) which does not require Meson, and is also (fairly) portable across environments.

We add the following new files:

data/
  icons/
    icon-foo.svg
    icon-bar.svg
  icons.gresource.xml

The icons are placed under the data/icons directory.

The icons.gresource.xml file looks like this (adapt it as required, e.g. using -symbolic icon names):

<?xml version="1.0" encoding="UTF-8"?>
<gresources>
    <gresource prefix="com/example/Foobar/icons/24x24/actions/">
        <file preprocess="xml-stripblanks" alias="icon-foo.svg">icons/icon-foo.svg</file>
        <file preprocess="xml-stripblanks" alias="icon-bar.svg">icons/icon-bar.svg</f…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@chriskilding
Comment options

chriskilding Jul 31, 2023
Maintainer Author

Comment options

You must be logged in to vote
2 replies
@chriskilding
Comment options

chriskilding Aug 4, 2023
Maintainer Author

@chriskilding
Comment options

chriskilding Aug 12, 2023
Maintainer Author

Answer selected by chriskilding
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants