11

I have created file /home/pi/Desktop/DecoderPro.desktop with the contents

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=DecoderPro
Comment=JMRI DecoderPro
Icon=/home/pi/JMRI/resources/dp3_48x48.gif
Exec=/home/pi/JMRI/DecoderPro
Terminal=false;

Each time I click the icon on the desktop I get the message:

This text file 'DecoderPro' seems to be an executable script. what do you want to do with it "desktop entry"?

Is it possible to make this desktop shortcut to start automatically, without the message?

EDIT: It seems that /home/pi/JMRI/DecoderPro is the source of the problem. It is also script starting with #! /bin/bash. But it is also +x.

Currently I have buster 10 version and if I remember right, in previous version of Raspbian this worked.

Pygmalion
  • 458
  • 2
  • 7
  • 23
  • 1
    Did you try to make it executable? chmod +x ~/Desktop/DecoderPro.desktop – jake Jul 15 '19 at 11:59
  • Yes. Didn't help. – Pygmalion Jul 15 '19 at 12:20
  • @jake Maybe this will help. /home/pi/JMRI/DecoderPro is also a script that starts with #! /bin/bash. It is also +x. – Pygmalion Jul 15 '19 at 16:09
  • @Pygmalion, And if the problem came from the line: Comment = JMRI DecoderPro, DecoderPro is also after this space ... try:Comment = "JMRI DecoderPro"maybe? – Ephemeral Jul 15 '19 at 16:44
  • @Ephemeral No, it didn't help. – Pygmalion Jul 15 '19 at 16:47
  • @Pygmalion, I see that here : `# The path to the folder in which the executable is run Path=/home/pi/JMRI

    The executable of the application, possibly with arguments.

    Exec=bash DecoderPro but I think you must call a binary not a shell script orbash DecoderPro` is probably correct ... I'm looking for that.

    – Ephemeral Jul 15 '19 at 16:54
  • @Ephemeral Exec=bash DecoderPro didn't help. What is even more mysterious is that I think that in previous version of raspbian this worked. – Pygmalion Jul 15 '19 at 17:12
  • @Pygmalion, ok I have remove my answer. I don't known. sorry. – Ephemeral Jul 15 '19 at 17:13
  • @Ephemeral But this worked on your raspberry, for a script without .sh as an extension? – Pygmalion Jul 15 '19 at 17:16
  • @Pygmalion, yes. My script for my test name is Voltage with just vcgen command , also i have no bash header but It 's on my older raspberry with jessie... have you try with Path ? here some related – Ephemeral Jul 15 '19 at 17:17
  • @Ephemeral I have buster 10, freshly installed few days ago, because SD card drop dead. Yes, I used Path command. – Pygmalion Jul 15 '19 at 17:23
  • 1
    For other noobs like me, found the solution https://www.raspberrypi.org/forums/viewtopic.php?t=248380#p1516491 – hbm Oct 04 '19 at 20:58

2 Answers2

9

Create a file /home/pi/Desktop/test.desktop:

[Desktop Entry]
Version=1.1
Name=test
Comment=The official
Icon=emblem-debian
Type=Application
Path=/home/pi
Exec=bash test
Terminal=true

bash script named test (UTF-8) in /home/pi dir:

echo hello world
read

adjust permissions:

chmod u+x /home/pi/test

Then open: ~$ pcmanfm go to Edit/Preferences/General, Check box for "Don't ask options on launch executable file" ref

Edit: Terminal must be true if you want to see the output of your script.

Tested on fresh Raspbian Buster install.

Jeff Puckett
  • 103
  • 4
Ephemeral
  • 2,157
  • 1
  • 6
  • 19
  • OK, this works for me. It is not on the desktop screen though... – Pygmalion Jul 15 '19 at 20:04
  • @Pygmalion, yes no icon on desktop. I would read more about this later and update my answer if needed. You have 3 tools starting with desktop-file-edit , desktop-file-verify and desktop-file-install , when I use edit tool, nothing is done. – Ephemeral Jul 15 '19 at 20:06
  • Actually when I used desktop-file-install, there was error because of using semicolon. It seems that semicolon after Terminal=false is also a problem. Original question is about icon on the desktop screen, so I would appreciate if you find the solution in that way. – Pygmalion Jul 15 '19 at 20:09
  • @Pygmalion, Yes indeed my answer is not really correct but it is an approach that works and that will surely help me to understand the future. I am currently looking for the desktop. – Ephemeral Jul 15 '19 at 20:11
  • @Pygmalion, it's ok after some hours , it's just a checkbox to uncheck, ho ! – Ephemeral Jul 15 '19 at 22:12
  • For me it works even with my original script, no Path, no bash. Just pcmanfm is necessary. – Pygmalion Jul 16 '19 at 05:22
  • @Pygmalion, You need terminal = true if you use an echo in the bash script else , no terminal is open and then nothing is displayed but yes Terminal can be false for 'background commands'. You have right for Exec work with Exec=/home/pi/test, the test require execution ( I had it removed) right else you have an Error : Invalid Desktop Entry file. – Ephemeral Jul 16 '19 at 11:29
0

thank for helping me out, you are my savior. I did follow your step

  1. Hit the terminal icon, then it will appear some thing like this "user@rasperipy: ~$"

  2. type in the command "pcmanfm" + enter

  3. There will be a window show up, n you guys follow his guide (go to Edit/Preferences/General, Check box for "Don't ask options on launch executable file)

  4. It should have a check box there which is empty, n you need to checked it

Excuse my typo <3

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. – Community Oct 13 '22 at 20:53