Bosse_B
Posts: 1074
Joined: Thu Jan 30, 2014 9:53 am

How to make a desktop shortcut work on Raspbian Buster

Sun Aug 16, 2020 5:00 pm

RPi4 with Raspbian Buster
I am accessing it via VNC from my Windows PC.

I am working on a new software project and in order to view it easily I would like to have a desktop icon to launch the program.
It is a compiled binary.

The instructions I have found for this when googling is:
1) Create a new file named MyApp.desktop in ~/Desktop
2) Edit it and put this into it:

Code: Select all

[Desktop Entry]
Name=SerialTest
Comment=Test application
Icon=/usr/share/pixmaps/openbox.xpm
Exec=/home/pi/projects/testing/remoteio/SerialTest
Type=Application
Encoding=UTF-8
Terminal=false
3) Change the file permissions

Code: Select all

chmod +x ~/Desktop/MyApp.desktop
Now the application can be started from the icon that appears.
Only it does not really work...
Instead there is always a dialog popping up saying:
Execute File
This text file MyApp.desktop seems to be an excutable script.
What do you want to do with it?
[Execute] [Execute in Terminal] [Open] [Cancel]
This happens EVERY time, does not remember that I click Execute...
What am I doing wrong here?
I wanted to make it simple to start the application but this does not really work...
Bo Berglund
Sweden

User avatar
pasman1
Posts: 109
Joined: Mon Aug 10, 2020 3:01 pm
Location: Poland

Re: How to make a desktop shortcut work on Raspbian Buster

Sun Aug 16, 2020 5:28 pm

do not use chmod.

works for me.

Code: Select all

[Desktop Entry]
Name=Vlc
Comment=Test application
Icon=/usr/share/pixmaps/openbox.xpm
Exec=/usr/bin/vlc
Type=Application
Encoding=UTF-8
Terminal=false
RPi4-4GB Multiboot RaspOS 32/5.10, RaspOS 64/5.4Bootloader: 2020-09-03, VL805: 000138a1

pidd
Posts: 1266
Joined: Fri May 29, 2020 8:29 pm
Location: Birkenhead, Wirral, UK
Contact: Website

Re: How to make a desktop shortcut work on Raspbian Buster

Sun Aug 16, 2020 5:32 pm

Maybe

Code: Select all

Type=Link
Because the item in the desktop isn't an application?

Bosse_B
Posts: 1074
Joined: Thu Jan 30, 2014 9:53 am

Re: How to make a desktop shortcut work on Raspbian Buster

Sun Aug 16, 2020 6:31 pm

pidd wrote:
Sun Aug 16, 2020 5:32 pm
Maybe

Code: Select all

Type=Link
Because the item in the desktop isn't an application?
Does not work!
Now there is no pop-up where I can select to run the item, just opens the Mousepad app with the text of the desktop file shown.

Code: Select all

Exec=/home/pi/projects/testing/remoteio/SerialTest
This is an executable application and before I changed the Type to what you suggested it started after I clicked the execute item in the dialog that no longer is displayed after the edit.
The app works fine if started but Raspbian seems to refuse to actually start it.
Bo Berglund
Sweden

Bosse_B
Posts: 1074
Joined: Thu Jan 30, 2014 9:53 am

Re: How to make a desktop shortcut work on Raspbian Buster

Sun Aug 16, 2020 6:44 pm

If I move the desktop file into ~/.local/share/applications then it appears inside the Pi menu below "Other" and can be started from there without the extra dialog.
If I right-click it in the menu I get the option to "Add to desktop" but if I do this again it will pop up the dialog when used....
Bo Berglund
Sweden

gordon77
Posts: 5264
Joined: Sun Aug 05, 2012 3:12 pm

Re: How to make a desktop shortcut work on Raspbian Buster

Sun Aug 16, 2020 6:58 pm

Try this...

Start filemanager

[Edit] -> [Preferences] -> [General]

[X] Don't ask options on launch executable file

Bosse_B
Posts: 1074
Joined: Thu Jan 30, 2014 9:53 am

Re: How to make a desktop shortcut work on Raspbian Buster

Sun Aug 16, 2020 8:22 pm

Thanks! :D
Problem solved!
Bo Berglund
Sweden

amoun
Posts: 9
Joined: Tue Oct 27, 2020 7:25 pm
Location: Cornwall, UK
Contact: Website

Re: How to make a desktop shortcut work on Raspbian Buster

Tue Nov 03, 2020 3:06 pm

gordon77 wrote:
Sun Aug 16, 2020 6:58 pm
Try this...

Start filemanager

[Edit] -> [Preferences] -> [General]

[X] Don't ask options on launch executable file
Thanks again: Same problem ~ same solution

Return to “General discussion”