Run a executable script from the desktop

I’ve created an executable script file on the desktop. How do I run this script?

There is no option “Run” in the menu.

If I select Actions run in KConsole I see:

If I open a KConsole and start it it works.

How your script first line looks like? You may be missing the interpreter

#!/bin/bash

when you double click on it, you should get a popup like this.

unless you’ve checked the box

it also depends on what the script does… if you are expecting stdout like you would get if your ran it in a terminal, then that obviosly won’t happen unless you start a terminal from with in the script like so

konsole --hold -e bash -c “echo ‘hello’ ; exec bash”

It was called logon-fw.sh and I renamed it now to logon-fw as it does not need a shell (it starting curl) Now it just opens kwrite

I don’t expect an output. It should just instruct our fw to open the walled garden.

Thats a good one. Had it there but than it only runs curl so no need for shell.

Can confirm that the desktop context menu is missing an option to run scripts, even if they’re correctly set executable and include a correct shebang. If you opted to always open script files as text files there is no way to execute them from the desktop, apart from the “run in konsole action”:

In comparison, opening the context menu on the file via dolphin (in the ~/Desktop folder):

Side note: Dolphin’s short cut “Middle Click” for Kate is actually wrong here, because Kate is the primary action and middle click actually starts VSCodium

Edit: you could actually argue that the Desktop Context Menu is actually the correct one, but needs a “Run Executable” Action in the “Open With” Sub-Menu

1 Like

sounds more like what you actually want is a .desktop file that executes your command directly without need for a shell script.

right click on the app launcher and edit applications.

from the menu editor you can create a new entry, name it, give it an icon, and in the command box just enter the command you want it to run.

don’t forget to save your work.

now you can drag that application to the taskbar, panel, or the desktop and run it by clicking on it.

2 Likes

There is not “app launcher” in my KDE Desktop. Ah you mean the KDE icon on the taskbar.

Should I put the script name as “Program:” ? Or do I add ‘/usr/bin/curl’

yes the app launcher or app menu usually the first widget in the task bar.

you can call it whatever you want, i would recommend a more semantic name that describes what it does, but you can give it any nonsense name, it’s just a label.

on the general tab there you can either specify the binary on the program line and any command line arguments on the next line, or you can can specify your script on the program line.

it all depends on how complex your script needs to be.

if its just executing a command with some command line arguments you just enter them directly, no need for a script.

if you need to interact with the user or if there is branching logic, then a script would be more appropriate and you can evoke a terminal window under the advanced tab for the user to give and receive feedback.

the world is your oyster.

1 Like