Executable script can't run directly from desktop in Arch Linux

5,816

If that isn't working then you can create a .desktop file for your script. It would look something like this:

# $Id: vbox-starter.desktop 22 $
[Desktop Entry]
Name=Custom Virtualbox Starter
GenericName=VBox
Comment=VBox
Exec=VBoxSDL --startvm virtualmachine
Terminal=true
Type=Application
Icon=Virtualbox
Categories=GNOME;GTK;Utility;

Note that since your script contains only one single line, you can put that directly in the Exec value:

Exec=VBoxSDL --startvm virtualmachine

In case you, your script was very long with multiple lines of code, then just put it this way:

Exec=~/Desktop/myscript
Share:
5,816

Related videos on Youtube

Mas Bagol
Author by

Mas Bagol

I am undefined variable

Updated on September 18, 2022

Comments

  • Mas Bagol
    Mas Bagol over 1 year

    Before, I was using Linux Mint and I can run bash script directly from desktop just with chmod the script to executable. For example, I have a script like this:

    #!/bin/bash
    VBoxSDL --startvm virtualmachine
    

    then:

    chmod +x myscript
    

    In desktop. I just need to double click the script that I've created.

    Now, I'm using Arch Linux with gnome-shell. The same way doesn't work. Instead, double clicking only runs text editor. Right click, too, show only gvim editor to launch the script and open with other applications option which doesn't have run script directly. So, how can I launch the script directly from desktop environtment without terminal?

    • TomTom
      TomTom about 9 years
      You probably need to have an entry in your right click context menu that runs the script. In XFCE that is fairly easy, you just create an action, but I don't know about GNOME.
    • don_crissti
      don_crissti about 9 years
      This has nothing to do with gnome-shell or your text editor (or archlinux), it's a file manager feature. In nautilus Preferences > Behavior > check Run executable text files when they are opened.
    • Matthias
      Matthias almost 5 years
      If you're using GNOME 3, see the solutions on this question: askubuntu.com/questions/138908/…
  • Mas Bagol
    Mas Bagol about 9 years
    doesn't work. I've tried that
  • Mas Bagol
    Mas Bagol about 9 years
    But, what I'm asking is about launching script, not desktop entry.
  • shivams
    shivams about 9 years
    Perhaps Arch Linux doesn't support running scripts by double clicking. I don't really know. Never used it. But this solution does solve your problem. Moreover, your script is just one line of code, you can just put it in Exec part above.
  • shivams
    shivams about 9 years
    Which windows manager and desktop manager are you running, btw?
  • Mas Bagol
    Mas Bagol about 9 years
    gdm and gnome3
  • shivams
    shivams about 9 years
    Well, did this solution work for you? : askubuntu.com/questions/138908/…
  • Mas Bagol
    Mas Bagol about 9 years
    Not working. Maybe I should stik with desktop entry file