Standalone App Icon - Linux Makefile

I’ve made a standalone JUCE app with app icons set in the Projucer for MacOS, Windows, and Linux. The app icon seems to appear properly for the apps I’ve built for both MacOS and Windows, but I cannot get the app icon to appear for the app built on Linux (Ubuntu) using the Projucer’s exported Makefile.

I made sure to set both the “Icon (Small)” and “Icon (Large)” settings in the Projucer project for the “Linux Makefile” exporter. I am using PNG files for the icon.

Has anyone ran into this issue? I am not super familiar with Linux, so maybe there’s something simple I am missing.

Thanks!

You need to create a .desktop file pointing to your png and place it in system wide folder (which may vary depending on the distro). Usually this step is done by an install step.

2 Likes

Awesome, thanks for the help!

I did some more searching based on what you said and was able to achieve this installation step by creating a local Debian package (.deb) which can be installed to Debian based Linux systems like Ubuntu. I noticed that the Linux version of Tracktion Waveform does something similar to this since they provide a Debian package file (.deb) to install Tracktion.

Setting up a minimal Debian package is pretty easy, so here’s a quick guide for anyone who finds this thread.

Just create a file hierarchy that looks like the following with package_name replaced with the name of the app/package you want to be installed on the user’s system:

package_name
│
└───DEBIAN
│       control [text file with package info]
│   
└───usr
    └───bin
    │       YOUR_EXECUTABLE_FILE
    │       
    └───share
        └───applications
        │       package_name.desktop [text file with application info]
        │
        └───pixmaps
                package_name.png/.svg [your app's icon file]

The contents of the control text file in the DEBIAN directory could look something like this, filling in the fields with the appropriate content for your application.

Package: package_name
Version: 1.0
Section: custom
Priority: optional
Architecture: all
Essential: no
Installed-Size: 1024
Maintainer: Person<person@website.com>
Homepage: https://website.com
Description: A simple description of the app.

Here’s documentation for the various fields this file could have: 5. Control files and their fields — Debian Policy Manual v4.5.1.0

Next, in the bin directory, make sure the file YOUR_EXECUTABLE_FILE is replaced with your applicataion’s executable.

Next, the file package_name.desktop in the usr/share/applications directory provides more information about your app. Again, replace package_name with the actual name of your package. The file may look like the following, with MyApp being replaced with your application’s name:

[Desktop Entry]
Name=MyApp
GenericName=MyApp
Comment=Breif Description of MyApp
Exec=/usr/bin/YOUR_EXECUTABLE_FILE %u
Icon=package_name
Terminal=false
Type=Application
Categories=AudioVideo;
Version=1.0

Finally, make sure to place your PNG or SVG icon in the directory usr/share/pixmaps. The image file’s name should correspond to the name given for the Icon field in package_name.desktop. The actual image file should have an extension (.svg or .png), but the Icon field name should be the name of the file without the extension.

After creating this directory structure and filling it with the proper files, use the command prompt to cd to the directory containing the top level package_name folder. Then run the following command:
dpkg-deb --build package_name

A file called package_name.deb should be produced.

To install the package on the user’s system, all they need to do is double click the .deb package file and the Software Install app should open, allowing them to click to install the app and it’s icon.

1 Like