How to use built in system `/usr/share/` icons with fnott?
I'm sorry, I have a feeling this is a user issue but I haven't been able to find it documented anywhere.
On the ArchWiki, the default
notify-send example is:
notify-send 'Hello world!' 'This is an example notification.' --icon=dialog-information
For me, it shows up without the icon...
fnott.ini I've tried setting different values for
icon-theme besides the default
hicolor but I can't seem to get any of the default icons in
/usr/share/icons to show up.
Everything works fine if I set the complete icon path, but I would like to just use the standard icon names so that when themes are changed the corresponding icons are used.
Please advise what I need to do to get the icons to be pulled in correctly.
Happy to provide more details if needed.
Running fnott v1.1.1 on Sway v1.5.1 on Ubuntu 21.04
notify-send 'Hello world!' 'This is an example notification.' --icon=dialog-information
This should work, assuming you have set
icon-theme correctly. What did you set icon theme too?
The name must match one of the directories under
/usr/share/icons (or rather, under
XDG_DATA_DIRS/icons). I.e. it is case sensitive.
Have you verified that your
fnott.ini is in the correct location? I.e. do other settings work?
Another thing, perhaps obvious; you need to restart fnott after modifying
I've never heard of this directory? Which applications are using it?
Thank you for replying so quickly!
When I check $XDG_DATA_DIRS, I have:
So that includes
/usr/share/icons I have a bunch of choices, but the fnott default is
hicolor and I haven't changed that value.
/usr/share/icons ls Adwaita/ Oxygen_White/ gnome/ Bluecurve/ Oxygen_Yellow/ handhelds/ Breeze_Snow/ Oxygen_Zion/ hicolor/ DMZ-Black/ Yaru/ locolor/ DMZ-White/ breeze/ nuoveXT2/ HighContrast/ breeze-dark/ redglass/ Humanity/ breeze_cursors/ ubuntu-mono-dark/ Humanity-Dark/ default/ ubuntu-mono-light/ KDE_Classic/ desktop-base/ vendor/ LoginIcons/ elementary-xfce/ whiteglass/ Oxygen_Black/ elementary-xfce-dark/ cab_extract.png Oxygen_Blue/ elementary-xfce-darker/ cab_view.png
I am certain the
fnott.ini is being read, because each time I reconfigure
fnott, I've been running it in the foreground and see:
~/SourceInstall/fnott pkill fnott ~/SourceInstall/fnott fnott info: config.c:887: loading configuration from /home/ryan/.config/fnott/fnott.ini
/usr/share/icons/hicolor there are many folders... I have no idea how
fnott decides which of these subfolders it's going to look in.
/usr/share/icons/hicolor ls 1024x1024/ 22x22/ 36x36/ 64x64/ apps/ index.theme 128x128/ 24x24/ 42x42/ 72x72/ scalable/ 16x16/ 256x256/ 48x48/ 8x8/ symbolic/ 192x192/ 32x32/ 512x512/ 96x96/ icon-theme.cache
I haven't changed the fnott default
max-icon-size=32, so does it use the
32x32 folder? Or does it always use the scalable folder? What is the logic for which of these "size" folders are selected?
Once you do choose an folder like
32x32, you still have a bunch more subfolders, like:
/usr/share/icons/hicolor/32x32 ls actions/ devices/ intl/ stock/ animations/ emblems/ mimetypes/ session-properties.svg apps/ emotes/ places/ categories/ filesystems/ status/
/usr/share/icons/hicolor/scalable lsactions/ categories/ emotes/ mimetypes/ status/ animations/ devices/ filesystems/ panel/ stock/ apps/ emblems/ intl/ places/ workrave-sheep.svg
For example, I do have an .svg icon at:
/usr/share/icons/hicolor/scalable/apps/qemu.svg and when I call
notify-send with the full path: it works:
notify-send 'Hello world!' 'This is an example notification.' --icon=/usr/share/icons/hicolor/scalable/apps/qemu.svg
However, whenever I try to use just the icon name like
qemu in this case, for any icon I've tried, I'm not able to get any of them to display. To give a small example, I tried every permutation I could imagine for a whole lot of possible icons, but haven't been able to get any of them to display just based on the icon name, or even any truncated version of the icon path.
~ notify-send 'Hello world!' 'This is an example notification.' --icon=scalable/apps/qemu.svg ~ notify-send 'Hello world!' 'This is an example notification.' --icon=scalable/apps/qemu.svg ~ notify-send 'Hello world!' 'This is an example notification.' --icon=apps/qemu.svg ~ notify-send 'Hello world!' 'This is an example notification.' --icon=apps/qemu ~ notify-send 'Hello world!' 'This is an example notification.' --icon=qemu.svg ~ notify-send 'Hello world!' 'This is an example notification.' --icon=qemu.svg
Sorry for being so verbose. If it's already part of
fnott then I've obviously missed something somewhere. At least we can hopefully make this into a concise FAQ entry for the future.
Each theme has an
index.theme file that lists its own directories. Fnott will scan through all these directories, choosing the icon that most closely matches the preferred size. This means it should pick the scalable variant, if it exists.
At this point, it might make sense to try enable debug logging and see which folders fnott is looking at. Unfortunately, this requires recompiling fnott. If you feel comfortable doing that, apply this patch:
diff --git a/icon.c b/icon.c index 5012cc7..52e58b8 100644 --- a/icon.c +++ b/icon.c @@ -16,7 +16,7 @@ #include <tllist.h> #define LOG_MODULE "icon" -#define LOG_ENABLE_DBG 0 +#define LOG_ENABLE_DBG 1 #include "log.h" #include "png-fnott.h" #include "svg.h"
and then compile a debug version of fnott. Finally, start fnott manually from a terminal to see the log output.
Another alternative could be to
strace fnott. It'll be more text to go through to see the directories, but on the other hand can be done on a pre-built release binary.
Finally, start fnott manually from a terminal to see the log output.
I'll have to take that back... The logging done, even with debug logs enabled, isn't enough.
strace it is.
I would suggest running something like
strace fnott > /tmp/fnott-strace.log 2>&1. If you're not comfortable looking through the output yourself, just attach it here and I'll have a look.
@dnkl Thanks so much for your help with this! First off, I wasn't aware of how the
/usr/share/icons/*/index.theme files worked so that's for explaining that!
strace I think I've gotten a bit closer to understanding the problem... For a test I set my
icon-theme=FunkyFoo (just a test name that doesn't exist)... Instead of searching under
/usr/share/icons/FunkyFoo Fnott is searching under
/usr/share/ubuntu/icons/FunkyFoo and the same for the backup default
hicolor, it's actually searching under
If I copy the
.svg icon to the path that Fnott is searching, I'm able to display it in the
So I think perhaps this is an Ubuntu vs Arch compatibility issue... For reference, here are the icon paths that I see being searched in strace... Any thoughts on something else that I can configure to search
openat(AT_FDCWD, "/home/ryan/.local/share/icons/FunkyFoo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/ubuntu/icons/FunkyFoo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/home/ryan/.local/share/flatpak/exports/share/icons/FunkyFoo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/var/lib/flatpak/exports/share/icons/FunkyFoo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/local/share//icons/FunkyFoo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share//icons/FunkyFoo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/var/lib/snapd/desktop/icons/FunkyFoo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/home/ryan/.local/share/icons/hicolor", O_RDONLY) = 4 openat(4, "index.theme", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/ubuntu/icons/hicolor", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/home/ryan/.local/share/flatpak/exports/share/icons/hicolor", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/var/lib/flatpak/exports/share/icons/hicolor", O_RDONLY) = 4 openat(4, "index.theme", O_RDONLY) = 5
I explicitly set my
icon-theme=Adwaita and then did a test for
phone-symbolic and the icon is displayed properly.
I still don't understand why the default
hicolor icon set isn't working and is incorrectly choosing a path of
/usr/share/ubuntu/icons/hicolor (inserting the extra
ubuntu directory in the middle.
For reference, I've attached the full strace output of:
- fnott-strace-Adwaita.log - when
- fnott-strace-hicolor.log - when
- fnott-strace-icon-theme-unset.log - when no value for
I'm a bit short on time right now, and will have to take a deeper look later. But it looks like the problem is that fnott stops searching for a particular theme as soon as it has found it in one of the
So, fnott will search all the
XDG_DATA_DIRS, in order. This is why it first looks at
/usr/share/ubuntu/*/, and look in all of them until it finds a valid theme, with a name matching the configured one.
With hicolor, it finds
/var/lib/flatpak/exports/share is from your
XDG_DATA_DIRS. And then fnott stops there, even if it cannot find the icon it's searching for.
It should probably continue searching the remaining
XDG_DATA_DIRS in this case. So, a fnott bug :)
notify-send 'Hello world!' 'This is an example notification.' --icon=blueman-device
In case anyone else needs to checkout a pull request, I did:
git clone https://codeberg.org/dnkl/fnott.git && cd fnott git fetch origin pull/18/head:foo # note 18 was the number of the pull request # "foo" is just your local branch name... Could be whatever you like git checkout foo
Then build the debug version with:
mkdir -p bld/debug && cd bld/debug meson --buildtype=debug ../.. ninja ./fnott
Deleting a branch is permanent. It CANNOT be undone. Continue?