How to properly load and package application icon?

Hi, desktop dev newbie here, making my first GTK app in Rust. My question might be related to desktop development in general more then it is to GTK, but I’m not sure.

As I understand, DE should take care of app launcher icon loading using info from .desktop file, but what about that status icon of the running app (on the shell panel next to “Activities” button in Gnome)? As I understand, the app shouldn’t load it itself, because of different icon themes. Or should it? If yes, what is the right way to do it in GTK? If no, what is the right way to make it displayed? Also, how to properly set application name so that it would be displayed next to the icon instead of just “.”?

screenshot

Any links with relevant info are appreciated too.

It should be a symbolic version of your app icon.

You need to install it as ${datadir}/icons/hicolor/symbolic/apps/${appid}-symbolic.svg.

At that point, the Shell should pick it up automatically, just like it picks up the icon you specified in your ${appid}.desktop file.

1 Like

Thank you!

It didn’t work for me at first, because I named my desktop file qwertone.desktop and icons as org.azymohliad.Qwertone.svg/org.azymohliad.Qwertone-symbolic.svg (although the app launcher icon loaded properly). But then I renamed desktop file to org.azymohliad.Qwertone.desktop and it works!

Great that you could make it work.

In general, the convention is have everything named after your app id:

  • the icons as org.azymohliad.Qwertone.svg and org.azymohliad.Qwertone-symbolic.svg
  • the desktop file (as you renamed it) as org.azymohliad.Qwertone.desktop
  • the appdata file as org.azymohliad.Qwertone.metainfo.xml
  • if you have a DBus service, it should also be prefixed by org.azymohliad.Qwertone
  • if you have a GNOME Shell search provider, prefix it by org.azymohliad.Qwertone as well
  • there might be other things I’m forgetting right now…

This way, when you eventually provide a flatpak build of your application, and you also name it org.azymohliad.Qwertone then everything will just work as expected. :slightly_smiling_face:

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.