Hi, I’m trying to add a shortcut for a game called Starsector to my KDE launcher. The game runs via a .sh script. Running the .sh via Dolphin launches the game just fine. When I try running it from the launcher the launching animation (from KDE) plays but the game never starts. Is there any special configuration required for starting a .sh script from the launcher?
I tried searching for this online but all the hits are either for adding an application to launcher in general, not .sh specifically. And I get a lot of hits about auto starting applications which isn’t helpful either.
Some help would be much appreciated. Thanks in advance.
I remember a bug where autostart scripts won’t start without a shebang. Maybe this is related. Make sure the script starts with this line (replace shell if needed):
sh -c '/path/to/script > ~/starcrash.log 2>&1'
or bash -c '/path/to/script > ~/starcrash.log 2>&1'
Into the Program: field.
The resulting file should tell you what’s wrong.
If it doesn’t help, put sh -c 'env | sort > ~/envtest-l.txt' into that field, execute the launcher, then env | sort > ~/envtest-t.txt in a terminal, and lastly
Hi everyone, thanks so much for your replies! I’m really grateful for the help.
In the end setting the path to the directory of the .sh was the solution.
I really appreciate all the advice for how to troubleshoot the issue via logging. I tried them all out, it should help out next time I run into any issues. And it gives me some practice in bash scripting and error piping.
For example piping the error stream into ~/starcrash.log gave me this error:
/home/herman/Games/starsector/starsector.sh: line 3: ./jre_linux/bin/java: No such file or directory
This wouldn’t have made it easy to figure out per se but its a good starting point for solving stuff myself.
Obligatory thanks to any KDE contributors in general as well for the great DE!
Would it be good if KDE Launcher set the working directory to the program directory by default? Or would that be bad practice somehow.
Spot on, nite_route1d! That missing working directory is such a classic trap when launching shell scripts from the KDE app launcher compared to Dolphin. Explicitly setting the Path= property alongside /bin/bash fixes those relative path issues instantly. Great catch!
I assume things still aren’t working or you @gibibit would’ve said so?
And I still assume that this script Just Works if executed from a konsole window.
Is java local-installed under the game folder?
Does the launcher work if you set Path to the game folder as per spec?
If not, what exactly is on line 3 in that bash script?