1

I have created a desktop launcher to execute a bash script but the problem is with directory. The file to be executed by launcher lies in /home/techy/folder/file.sh and the desktop launcher is located in /home/techy/Desktop/app-launcher.desktop. So its not executing the file properly.

[Desktop Entry]
Version=1.0 
Name=update 
Comment=This is launcher 
Exec=/home/techy/folder/file.sh 
Icon=/home/techy/Pictures/icons/update_icon.png 
Terminal=true 
Type=Application
Mark Kirby
  • 18,529
  • 19
  • 78
  • 114
techy
  • 127
  • 1
    Please cat launcher file here – Nullpointer Jan 10 '17 at 10:55
  • from the terminal I need to change to proper directorory

    "cd /folder" "./file.sh"

    I want the .desktop to do this.

    – techy Jan 10 '17 at 10:55
  • You can mention full path of Script in laucher file. There would be minor mistake. – KK Patel Jan 10 '17 at 10:58
  • @RGG- can you explain a bit more ? Not able to get you. – techy Jan 10 '17 at 10:58
  • @KetanPatel Patel- Not working like that. – techy Jan 10 '17 at 11:00
  • Give me output of app-launcher.desktop file – Nullpointer Jan 10 '17 at 11:01
  • The launcher goes to the file.sh but its not producing desired output. The window closes without producing desired output. – techy Jan 10 '17 at 11:04
  • 1
    You need to tell us, what your script does and show the contents of the .desktop in full. Otherwise this vague and difficult to answer because there are so many things that could be wrong. Also does your script work without the .desktop? Sounds more like the script is failing. – Mark Kirby Jan 10 '17 at 11:11
  • 1
    One more thing, did you chmod +x BOTH of those files> sh and desktop? – Mark Kirby Jan 10 '17 at 11:13
  • yes. I can execute my script from terminal. I need to change directory to cd /folder and then ./file.sh. Then I get proper output. the problem with .desktop is the directory issue I guess. This is my .desktop script

    " [Desktop Entry] Version=1.0 Name=update Comment=This is launcher Exec=/home/techy/folder/file.sh Icon=/home/techy/Pictures/icons/update_icon.png Terminal=true Type=Application"

    The .desktop have 775 permissions

    – techy Jan 10 '17 at 12:16
  • 1
    Wait, you mention: The window closes without producing desired output. Possibly the output was correct, but the issue is that you need to keep the window open after executing? A totally different issue. Please mention. (also what the script should do). – Jacob Vlijm Jan 10 '17 at 12:41
  • Hi @MarkKirby, ~ won't work in a .desktop file like that :) – Jacob Vlijm Jan 10 '17 at 12:47
  • Sure I saw your answer @JacobVlijm Going off your last comment about the window closing, perhaps Techy this may help you http://askubuntu.com/a/176249/75060 It will force the terminal to stay open after completing. Modified for you Exec=gnome-terminal -e "bash -c cd /folder && file.sh;bash" – Mark Kirby Jan 10 '17 at 12:55

1 Answers1

0

Make sure that /home/techy/folder/file.sh has execution permission by all users.

KK Patel
  • 19,083