Double clicking a script no longer works

Before the recent big update, I could double-click bash scripts (*.sh files) that I had created in a text editor to do various tasks. I had made them executable and placed them in a “scripts” folder. Now when I double-click them, they just open in mousepad.

What changed? How can I change it back?


*** ALTHOUGH *** I had marked my next comment as the solutrion, it isn’t QUITE the solution…

SOME of my scripts that USED to work when double-clicked still don’t work, although they work fine when executed from a terminal.

Well I still don’t understand what changed or why but I just solved my own issue with this:

$ thunar -q
$ xfconf-query --channel thunar --property /misc-exec-shell-scripts-by-default --create --type bool --set true

This fix came from:

I looked at the XFCE 4.16 Changelog and didn’t see a Thunar change.

misc-exec-shell-scripts-by-default looks like it was part of XFCE 4.12/issue (search for Thunar).

I’m a former KDE user and learning the ways of XFCE. With KDE’s Dolphin there was a right-click Action to run a script. This is supported in Thunar too. So a user could keep the default behavior of click opens an editor and right-click provides a menu item to run the scripts.

Add right-click Run Script
  1. Backup and Edit Thunar configuration

    cd ~/.config/Thunar
    cp -a uca.xml uca.xml.20210203
    nano uca.xml

  2. Insert text below inside <actions></actions>

   <!-- Doc: man xfce4-terminal -->                                                                                                                    
   <name>Run Script</name>                                                                                                       
    <command>xfce4-terminal --hold -- --command=%f</command>                                                                                
   <description>Execute a script in a terminal</description>                                                                     
  1. Ctrl-x (save)                                                                                                               
  2. Notify running Thunar daemon processes to refresh configuration

    killall -HUP Thunar

NOTE: Any errors seem to appear in journalctl.

Now when a user right-clicks they’ll have a Run Script menu item.

1 Like

It seems I’m still having some trouble. Here’s what’s going on…

  1. Scripts that did not require any terminal input or output, work fine with the previous fix.

  2. Scripts that DO require input or provide output messages, do not work.

  • They no longer open in mousepad when double-clicked. They just don’t do anything at all.
  • They DO work fine when executed in a terminal.

Am I missing some new parameter that opens a terminal window when I double-click my scripts?

My right-click (context) menu already has an “Execute” option at the top.

The top-most item in the Thunar context menu is the default action to be taken for an item (i.e., double-click activated).

The ‘misc-exec-shell-scripts-by-default’ property only creates an action that executes the item without a terminal. So the item must not require any terminal input to execute.

The solution from @stargazer provides a non-default action that will open a terminal and execute the item in that terminal allowing input to be provided and output to viewed.

I searched far and wide for a solution to the exact problem, but found only non-nonsensical answers everywhere else. Thanks for offering a solution. :slight_smile:

pcmanfm gives you the option of executing or opening