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.