Skip to content
Advertisement

How to set executable (application) icon in Linux based Qt

Idefault icon of executable in linux I want to change this default icon to my desired icon. How to do this ? I have searched and found solution for Windows How to set application icon in a Qt-based project? but not for Linux.

I have tried to do this using .desktop file by setting Icon = myPath/icon.icon or icon.PNG But it does not work. Any idea of how to do this ?

Advertisement

Answer

This question isn’t really Qt related.

In Linux, icons are set in the .desktop file in /usr/share/applications/ and not on the executable itself. To have an icon for your app, it must be installed on your system. Place the executable in /usr/bin, your icon of choice in /usr/share/icons/hicolor/ and put a .desktop file that corresponds to your application in /usr/share/applications:

[Desktop Entry]
Type=Application
Version=1.0
Name=(insert name of app)
GenericName=("Web Browser", "Media Player", etc. This isn't technically needed but makes your app look native on KDE)
Exec=(insert executable name)
Icon=(insert icon name)
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement