Run .sh files instead of opening them with a program by default

When first clicking an .sh file KDE asked my how I want to handle them, but I miss clicked and disabled the option that would run a .sh file by default.
Its not a big deal since I can still run .sh files in the terminal, but I couldn’t find an option to reset the default behavior when clicking on it.
So how can I reset the default behavior for .sh files or manually configure it to execute when clicking/double-clicking?

I think I would have to change the settings here:
KDE-Settings-> Applications->File association->application->x-shellscript
But I am not sure what I would have to choose in order for it to run as application on default(also I guess I removed everything in an attempt to reset the settings).

1 Like

If an ASCII text file is marked as executable the filemanager should - as a precaution ask what to do - not blindly execute as this could result in execution of a bad script.

PCManFM-Qt

ksnip_20220526-143607

In any case - check the file ~/.config/mimeapps.list perhaps it is located elsewhere - Dolphin is not my favorite.

By changing it in app’s settings/options - Dolphin’s I guess.

This popup would be the behavior I want/expect but I dont know how I can restore the behavior to that point, also I think when that pop-up first came up there also was a checkbox that said something like “never ask me again” and I clicked that and selected dont open/run or so and since than I cant run them when clicking,
on right click I just get asked which Application I want to use.

What would I have to change/check in the ~/.config/mimeapps.list file? It contains [Added Associations], [Default Applications] and [Removed Associations] but I dont really get if some of thouse apply to all .sh files marked as applications/allowed to run.

Check the file ~/.config/kiorc in your system. If you see the following lines in it

[Executable scripts]
behaviourOnLaunch=open

you can

  • delete these two lines from the file
    (this will result in a prompt dialog window every time you click on an executable file, which will ask you if you want to open or to execute the file)
  • change the lines to
[Executable scripts]
behaviourOnLaunch=execute

(this will execute the .sh file without any prompt)

2 Likes

Great this works, thank you!

What would I have to set if I want to get the pop-up prompt?

1 Like
behaviourOnLaunch=alwaysAsk
2 Likes

IN dolphin → hamburger → Configure → Configure Dolphin → General → Confirmations → When opening an executable file → Always ask

Screenshot

ksnip_20220526-144922

4 Likes

The “proper” way, go to Dolphin Settings → General → Confirmation → select your choice in the dropdown list.

2 Likes

Thank you all, that solves it. (:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.