Skip to content

Prevent scripts on desktop from executing by double-clicking

Issue Description

On Kali Linux using the XFCE desktop, I’ve noticed that shell scripts placed on the Desktop run immediately when double-clicked, instead of opening in my default editor.

However, when I double-click the same script in Thunar File Manager, it opens in Mousepad, as expected. Thunar respects the setting under Preferences > Behavior > Execute shell scripts > Never.

I’d like the Desktop to follow the same behavior — ideally, to never execute shell scripts on double-click, regardless of their location.

Steps to Reproduce Issue

  1. Create a shell script (e.g., helloworld.sh) with the following contents:

    #!/bin/bash
    x-terminal-emulator -e "bash -c 'echo Hello, world!; read -p \"Press Enter to close...\"'"
  2. Make the script executable:

    chmod +x helloworld.sh
  3. Set Mousepad as the default application for shell scripts.

  4. Move the script to the Desktop.

  5. Double-click it — the script runs instead of opening in the editor.

Expected Behavior

While the current behavior may be intentional for the Desktop, I believe it would be safer and more consistent if executable shell scripts did not run by default when double-clicked from the Desktop—similar to how Thunar respects the "Never execute" setting when launching scripts from the File Manager.

Ideally, there should be an option to configure this behavior, so users who prefer the current default can keep it, while others can opt for a safer, editor-only action.

Additional Information

I've come across a few common suggestions, but none offer a practical solution:

  1. Don’t place scripts on the Desktop – Not ideal, as I often use the Desktop for quick access.
  2. Remove executable permissions – Doesn’t work for scripts that do need to be executable.
  3. Use right-click > Open With > Editor – Too many clicks for frequent use and doesn't protect against accidental double click.

Environment & Versions

  • OS Distribution and Version: Kali GNU/Linux 6.12.25-amd64
  • XFCE Version: 4.20
  • xfdesktop Version: 4.20.1
  • GTK Version: Built with GTK+ 3.24.48, linked with GTK+ 3.24.49
  • Windowing System: X11
  • GTK Theme: Default
  • Icon Theme: Default
  • UI Scale Factor: Default