Create a Simple GUI To Run Scripts From?

Though I am not sure with .desktop files if that still applies
You mean the .sh? No, it doesn't. The ".desktop" is the extension of the file and as long as it is, there should be no permissions' problems.

This is what I did:
I think the problem might be that the script's owned by root, and not by your user. So, you can either rewrite it as your user, or change its ownership:
sudo chown username:username /usr/local/bin/CALLUM_UPDATE-SCRIPT
I think the problem might be that the script's owned by root, and not by your user. So, you can either rewrite it as your user, or change its ownership:
sudo chown username:username /usr/local/bin/CALLUM_UPDATE-SCRIPT
Same issue sadly. Even if I move the .sh to Documents and aim the .Desktop file to it I get the same "Broken .Desktop" error as above.
If installing system-wide, for all users, the script should be owned by root because you’re putting it into /usr/local/bin/ and should have 755 permissions: rwxr-x-rx

The .desktop file in /usr/share/applications should also be owned by root and have 644 permissions: rw-r—r—

The error appears to be a problem with the .desktop file itself. In my post, I did just write the example one quickly, off the top of my head. So maybe there’s something syntactically wrong in the .desktop file.
Also the .desktop file should be named after the program it launches, so your .desktop file should be called something like Callum_update_script.desktop.

I’ll have a play and will see what I can find out!
Aha - OK! The problem is the "press any key" bit that I advised you to add to the Exec= field in the .desktop file, after the main script has executed. So that's totally on me. Goes to show I'm not infallible! Ha ha.
You can only run one program/script in the Exec field. That's the reason for the error message.

The actual workaround I was thinking of, to prevent the window from quickly popping up and disappearing actually involves manually invoking a terminal in your .desktop file and then running your script in that.
So you'd change the following fields to this:
Exec=xterm -e '/usr/local/bin/yourExecutable; read -p "press any key to  continue..." -n1 -s'
Where yourExecutable is the name of the script/executable to run.
The reason we set Terminal to false above, is because we're now going to explicitly run xterm (A terminal that is commonly included by default in most Linux distros - even if it's NOT the systems default terminal.)
So your script will be running in a different terminal emulator. Which may not be an ideal solution.
I used xterm in the example, because it's commonly installed on most distros (or at least, it always used to be - might not be the case now), but you could substitute that for any other terminal emulator - you'd just have to look up the documentation for the terminal, in order to work out what flags you need to set in order to open the terminal and run a specific set of commands.

Also, in the above - if Terminal was set to Terminal=true - a default terminal window would popup which would run xterm. And because xterm is a graphical application, it would create it's own window. So setting Terminal to false, prevents the unnecessary default terminal from popping up.

Alternatively - another way around the problem, as I mentioned before would be to add a "read -p" command to your scripts, to pause the script.
At the end of each of your scripts - have a line that reads:
read -p "Press any key to continue..." -n1 -s

That way your .desktop files don't need to change. The Exec and Terminal fields would stay as:
Where yourScript is substituted with the name of your script.

OR (this one might be a winner) - another way around the issue would be to create a wrapper script that takes a path to another script, or executable as a parameter, which will execute the script and then prompts the user to press a key.
#!/usr/bin/env bash

# show an error message and exit
  echo -e "ERROR: $1\n"
  echo -e "Usage: scriptwrapper /full/path/to/executable/\n"
  exit 1

# Ensure we have one parameter
if [ $# -ne 1 ]; then
    die "Incorrect number of parameters!"

# Ensure the parameter is an executable file
if [ ! -x "$1" ]; then
  die "$1 is not an executable!"

# Run the executable and then prompt the user to press a key
read -p "Press any key to continue..." -n1 -s

Save that as scriptwrapper and make it executable with chmod +x ./scriptwrapper.
Copy that to /usr/local/bin (as root) alongside your other scripts - then you can use scriptwrapper to run your scripts in your .desktop files.
In your .desktop file for each of your scripts:
Exec=/usr/local/bin/scriptwrapper /usr/local/bin/yourscript
scriptwrapper requires the FULL path to your script/executable.

That way, when the icon is clicked in the menu, the .desktop file will open the systems default terminal and run the scriptwrapper script, passing your script as an argument. Then scriptwrapper will run your script. After your script has finished, the wrapper script will prompt the user to "press any key to continue..." - which will cause the terminal window to close when the user presses a key.
That might be a more elegant solution to the problem. That way you can run your scripts directly in the terminal with no annoying "Press any key" prompt. But if you run your scripts via your desktop menu/launcher - it will run it through the wrapper and display the "Press any key" prompt to prevent the terminal from disappearing too quickly.

That might be a better solution.

So the original problem had nothing to do with permissions as suggested by the others, it was simply a syntax error in the .desktop file, due to a brain-fart that I had. Completely my fault! Hopefully the scriptwrapper script I wrote makes up for my mistake! Ha ha.

BTW - DON'T make a .desktop file for the scriptwrapper script, just use the scriptwrapper script in the .desktop files that run your scripts.

I hope that all made sense?!....
Last edited:
@JasKinasis :-

We get so many Puppians asking about this very subject, I took the trouble to write a tutorial on the Puppy Linux forums purely about creating .desktop files.....which I then 'stickied', so it was easy for noobs to find.

Since writing it, the Mod's admin panel shows it's been viewed around some 3,500 times.....

(You're not the only one to go OTT with the detail in posts, BTW. I tend to be just the same..!! My old man told me, many, many moons ago, when I was barely knee-high to a grasshopper, that if something is worthwhile, then it's worth doing to the very best of your ability. Do it once, and do it properly the first time.....and that way, you don't have to keep coming back and re-doing it!

It's sorta stuck with me over the years.)

Mike. ;)
Last edited:

Staff online

Members online