I'm using Thunar 1.2.3 (Xfce 4.8)
When editing .sh files, I find very annoying that everytime I double click an .sh file, thunar executes it instead of opening with the default editor.
I can't find anywhere to change this.
Looks like shell scripts will always execute (if they have execute permission) when trying to open via Thunar.
Is there any way to change this behaviour?
Last edited by mtbrandao (2012-08-30 12:46:14)
If you right-click on the file in Thunar and go to Properties > Permissions, you should be able to uncheck the box that says "All this file to run as a program." It will then open in whichever text editor you have specified.
But I imagine you've already tried this. Does it not work? It certainly works for me with Thunar 1.4.0.
Yes, but then I can't execute it in terminal either using by calling the script directly.
Good point. I guess all you can do then is to right click the file in Thunar and use the "open with" option. But it's a bit inconvenient. Perhaps someone else has a solution.
I have about a dozen scripts, most of which get modified now and then, so I know what you mean. Sometimes I forget to right-click the script in Thunar to Open with... when I want to edit it, and the script executes.
A simple workaround for me, anyway, would be to create a Zenity list of the scripts which is called up by a simple keyboard shortcut. The command for each script in the list would be (in my case) gedit path/to/script. This way I would execute the scripts when I clicked on them in Thunar, and edit the scripts by using the Zenity trick.
For an example of a similar Zenity chooser, see
Today I right click and Open With text editor.
But I think a more correct approach would be remove the execution bit and open the script using bash / perl / whatever the script is made. in terminal ("bash script.sh")
What happens is that many times I just forget to "open with" and double click the script, executing it when I really want to edit. And some scripts can't be executed at any time (because they generate log, rename files, whatever).