2

I'm trying to let a script send a couple of notifications with custom pngs as icons. This could be easily put off as a duplicate of https://askubuntu.com/a/351637/329400, but it isn't. In fact, I tried this exact solution, but the icon didn't display:

notify-send -i /usr/share/icons/gnome/32x32/status/stock_lock-broken.png  summary test

notify-send -i /usr/share/icons/gnome/32x32/status/stock_lock-broken.png  summary test

I also made sure the image really exists in elementaryOS. It does:

xdg-open /usr/share/icons/gnome/32x32/status/stock_lock-broken.png

enter image description here

What happened?

2 Answers 2

4

I wrote a bunch of bash scripts a while ago, and struggled with this issue as well. This is what I have going now, and it works:

enter image description here

This icon is located in ~/.local/share/icons. In this case it's a .svg file, but it will also work with other types: enter image description here This is a python example:

enter image description here

And these are the results:

bash notification python notification

The general idea is to put the icon file in the icons folder, maybe also reload the icon cache, and refer to that image in you commands by its name (using the full path will not work), without the extension.

So, your command should look like this:

notify-send -i stock_lock-broken  summary test

enter image description here

2
  • So there seems to be no way to simply specify a file in a random location? Dec 30, 2017 at 13:16
  • 1
    There was a short discussiin about this, and it seems that, at least for now, in elementary os, notify-send does not accept full paths... bugs.launchpad.net/elementaryos/+bug/1511217
    – Vlad
    Dec 30, 2017 at 15:23
0

TL;DR

Place icons in:

~/.local/share/icons/image.png

OR

/usr/share/icons/image.png

and use them with:

-i image

OR

--icon=image

Do not add extension to image name in the command flag, just image name.

example:

notify-send --icon=razer -a 'Razer Raiju TE (xboxdrv)' --urgency=normal --expire-time=2000 'Microsoft X-Box 360 pad' "Removed"

OR

notify-send -icon razer -a 'Razer Raiju TE (xboxdrv)' --urgency=normal --expire-time=2000 'Microsoft X-Box 360 pad' "Removed"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.