How to add icon to ubuntu app

I developed an application for ubuntu in python using fast. I packed it and it works fine, but I could not find how to add an icon to my application, currently it is like a blank icon.

I used Glade and gtk.

+7
source share
1 answer

The best way is to install a "named icon". To do this, your script installation will copy the file to a specific location, which depends on the user system, but usually <datadir>/icons/hicolor/<size>/app/<app-name.png|svg> where datadir is something like /usr/local/share . The minimum recommended icon sizes are usually a scalable SVG icon and a 48x48 px PNG icon.

Once you have copied the icons to the desired location, you can update the GTK cache with the gtk- update-icon-cache command.

When you installed the "named icon", your application can refer to it by name:

 window = Gtk.Window window.set_icon_name("myapp") 

Now, one more thing you will need to do is install the "destop entry" record file. They tell Ubuntu (or GNOME or KDE or Xfce) about your application so that it can be launched, and also that it is an icon. You create the file according to the desktop specification and copy it to <datadir>/share/applicaions/ with the file extension .desktop . Examples from /usr/share/applications/ can be found in applications installed on your system. You can also use the Desktop Editor Editor to create the .desktop file. In the desktop file, the icon will also be installed on your "named icon".

So, to install a named icon and an entry on the desktop, you look at something like:

 /usr/local/share/applications/myapp.desktop /usr/local/share/icons/hicolor/scalable/apps/myapp.svg /usr/local/share/icons/hicolor/48x48/apps/myapp.png 
+7
source

All Articles