How to set up desktop shortcuts in KDE to run terminal commands?
Solution 1
You don't need a script to do that, in a terminal just do
$ which spyder
This gives you the full path to the file that's executed, I suppose /usr/bin/spyder
. Then just use that path for your Exec=
line.
Exec=/usr/bin/spyder
Solution 2
To configure KDE desktop shortcut to run specific command, you have to link the full path of the application.
i.e. use Exec=/home/(user)/Desktop/spy.sh
instead of Exec=/Desktop/spy.sh
(Because if you type /Desktop/spy.sh
the system will actually find files from /
--> /Desktop
, which this folder will probably never exist.)
And for runing Spyder
, follow dessert's answer.
Also, make sure spy.sh
is executable, or else Permission denied
will appear.
Related videos on Youtube
Alekh Karkada Ashok
Updated on September 18, 2022Comments
-
Alekh Karkada Ashok over 1 year
I am trying to make a desktop shortcut to launch
Spyder
, which can be launched by typingspyder
in terminal.I made a
spy.sh
script withspyder
in it. It works withbash spy.sh
and./spy.sh
. But when I make a desktop shortcut like this:[Desktop Entry] Name=spyd Exec=/Desktop/spy.sh Comment= Icon= Type=Application Terminal=true
It gives out an error:
"There was an error creating child process for the terminal. Failed to execute child process “/Desktop/spy.sh” (No such file or directory)"
Same error when I change into
Exec=spyder
What should I do?
-
Alekh Karkada Ashok over 6 yearsThanks a lot. Even though linking full path helped remove the error, I couldn't run spyder successfully, a program would come up in taskbar called "web browser" and close. Following dessert's answer did the work.
-
Cynplytholowazy over 6 yearsYou probably have a corrupted
spy.sh
script. Also, if you find an answer working, mark the answer accepted by clicking the checkmark icon. -
Alekh Karkada Ashok over 6 yearsBut it works when executed from terminal. BTW, why doesn't just writing spyder in Exec= work for me? (suggested here - stackoverflow.com/questions/39771849/…)
-
Cynplytholowazy over 6 yearsBecause the desktop environment won't automatically search for
spyder
for you. If you typeexport
you will see something likePATH=/usr/bin...
but KDE desktop won't check this parameter. -
Alekh Karkada Ashok over 6 yearsOh, so this is KDE specific and we can not run commands without making a script? Thanks!
-
Cynplytholowazy over 6 yearsNot really, most desktop environment won't do that as well.
-
dessert over 6 years@AlekhKarkadaAshok I consider the automatic path completion a terminal feature, it's a good idea to give the full path everywhere else, especially in config files.