Skip to content

Step 6: launchers and icons

iVAN edited this page Mar 16, 2022 · 1 revision

Now that we have the program in /opt/$APP and the link in $PATH (i.e. /usr/local/bin) we now need to run it. For GUI applications, what we need is a simple launcher to be placed in /usr/share/application that allows us to run the program from the application menu.

A simple *.desktop file that use an icon placed in /opt/$APP looks like this:

[Desktop Entry]
Name=$APP
Exec=$APP
Comment=
Icon=/opt/$APP/$APP.png
Type=Application
Categories=Utility;

If you want that your icon changes the theme, it must be placed in /usr/share/pixmaps, and the launcher will look like this:

[Desktop Entry]
Name=$APP
Exec=$APP
Comment=
Icon=$APP
Type=Application
Categories=Utility;

You can place the icon wherever you want, the most important thing is that it must be listed in the /opt/$APP/remove script (see STEP 2).

If you have the original launcher of the application, remember to edit it the way it cannot go in conflict with any existing installation of the same software.

To place the launcher into the script, replace the word "LAUNCHER" with the content of the .desktop file you want to create:

echo "LAUNCHER" >> /usr/share/applications/$APP.desktop

Optionally, if you've not placed a command before (for example in the STEP 4 during the compiling of a program), wou can download the icon in /opt/$APP this way:

wget https://SITE/TO/THE/ICON.png -O /opt/$APP/$APP.png