raspberry-piiconstaskbarraspbian-buster

application icon replaced by standard icon on raspberry pi task bar


I created an .desktop file for my python app with my own application icon (32x32). The icon shows correct in the system menu, and on the task bar (Application Launch Bar). After starting the app, the icon shows in the task bar in Ubuntu, but on Raspberry Pi, the icon of the running app is replaced by some default terminal-like icon.

The .desktop file is in folder ~/.local/share/applications, and looks like this:

[Desktop Entry]
Name=Infrared Camera
Comment=Take photos with both the infrared and visible light camera
Icon=/home/roland/projects/pi_thermal_camera/icon.png
Exec=/home/roland/projects/pi_thermal_camera/IR_Photo_buttons.py
Type=Application
Encoding=UTF-8
Terminal=false
Categories=Other;

This is icon.png of 32x32 pixels:

icon.png

This is the icon that is shown after starting the application:

the icon shown after starting the app

Here is a screenshot of the task bar after starting the application:

screenshot of task bar with different icons for the same app

The red and blue icon is a menu item on the task bar, and after clicking on it my Infrared app opens, and adds a terminal-like icon for the running app.

How can I get my nice own icon to show instead of that default icon when my app starts running?


Solution

  • I had the same problem and found the solution:

    1. Put your custom icon in /usr/share/icons/foobar.png
    2. Make sure everyone has read access to the icon
    $ sudo chmod 644 /usr/share/icons/foobar.png
    
    1. In the .desktop file you only need the filename without extension
    Icon=foobar
    
    1. Restart the application menu panel
    $ lxpanelctl restart
    

    The same icon is now used in the application menu, the application launch bar and the list of open applications.