I have developed an App for ubuntu in python using quickly. I packaged it and is working perfectly but i could not find how to add an icon to my App currently its like a blank icon.
I have used Glade and gtk.
Executables on Linux do not have icons embedded (try to point your file manager to /usr/bin ). What you have seen is probably a Desktop Entry. That's a text file describing the icon, program name and the executable.
The best way is to install a "named icon". To do this, your installation script will copy the file to a specific location which is dependent up on the user's system, but typically <datadir>/icons/hicolor/<size>/app/<app-name.png|svg>
where datadir
is something like /usr/local/share
. The minimum suggested icon sizes are typically a scalable icon with SVG format and a PNG icon that is 48x48 pixels.
Once you've copied the icons to the right place, you can update GTK's cache using the gtk-update-icon-cache
command.
When you've installed a "named icon", your application can refer to it by name:
window = Gtk.Window
window.set_icon_name("myapp")
Now, one other thing you'll need to do, is install a "destop entry" file. These tell Ubuntu (or GNOME or KDE or Xfce) about your application so that it can be launched and also what it's icon is. You create the file according to the Desktop Entry Specification and copy it to <datadir>/share/applicaions/
with a .desktop
file extension. You can see examples in /usr/share/applications/
from applications installed on your system. You could also use Desktop Entry Editor to create the .desktop
file. In the desktop file, the icon would be set to your "named icon" too.
So all in all, to install a named icon and a desktop entry, you're looking 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With