On Raspberry Pi, Autostart of executable does not show the correct icon and path

Please post all general support questions for LXDE here.
Locked
Søren
Posts: 2
Joined: Sat Jan 30, 2021 2:46 pm

On Raspberry Pi, Autostart of executable does not show the correct icon and path

Post by Søren »

I have an executable file that are generated from a python program by using auto-py-to-exe, a gui front for pyinstaller, and a .ico file for a 64x64 icon, both placed in /home/pi/TestAS/Program. The program uses the path to store some persistent data.

Both in /home/pi/.config/autostart and in /home/pi/Desktop I have placed a file named TestAS.desktop with the content:

[Desktop Entry]
Comment=Testing Auto Start
Exec=/home/pi/TestAS/Program/TestAS
Icon=/home/pi/TestAS/Program/TestAS.ico
Path=/home/pi/TestAS/Program
Terminal=false
Encoding=UTF-8
Type=Application
Categories=None;
Name[en_US]=TestAS

When I reboot the Pi, it starts the program, but it does not show the correct icon in the task bar (it shows the anonymous icon instead) and it places the persistent data out in /home/pi.

When I start the program by double clicking the icon on the desktop, it shows the correct icon in the task bar and places the persistent data in the correct directory.

Are there any of you good people who have ideas to get autostart to behave properly?
drooly
Posts: 791
Joined: Mon Apr 08, 2013 6:45 am

Re: On Raspberry Pi, Autostart of executable does not show the correct icon and path

Post by drooly »

Søren wrote: Sat Jan 30, 2021 3:23 pmBoth in /home/pi/.config/autostart and in /home/pi/Desktop I have placed a file named TestAS.desktop
The first one is the correct location for autostart.
When I reboot the Pi, it starts the program, but it does not show the correct icon in the task bar
That icon has nothing to do with the Icon defined in the desktop file, sorry.
You should check your application if ti can define a different icon.
it places the persistent data out in /home/pi.
I'm not so sure about the other values in your .desktop file; Have a look-see here:
https://specifications.freedesktop.org/ ... atest.html
OK, Path seems to be correct, but it's up to the application to honour that.
Søren
Posts: 2
Joined: Sat Jan 30, 2021 2:46 pm

Re: On Raspberry Pi, Autostart of executable does not show the correct icon and path

Post by Søren »

Thank you for your answer.

The point is that the "shortcut" (the .desktop file) works differently if it is placed on the desktop and double clicked, or it is in the autostart directory and started at boot up.

In the Desktop Entry Specification you refer to, Icon is "Icon to display in file manager, menus, etc.", I read "etc." as also being the icon shown in the task bar, and it works when started from the desktop.

In the same document Path is "If entry is of type Application, the working directory to run the program in". This also works when started from the desktop.

BR Søren
Locked