How does .desktop file EXEC field work?

7,654

If you use shell features you need to use sh -c "the command". Also, with Wine you need to set the current directory for some stuff. man wine

Share:
7,654

Related videos on Youtube

Karim
Author by

Karim

Updated on September 18, 2022

Comments

  • Karim
    Karim almost 2 years

    It's been several months I'm having this horrible problem. I'm currently using Unity 2D, and I manage my menu entries by using .desktop files, which is tiring. Is there a better way to manage them? Anyway, the problem comes from the EXEC field. I'm so tired! I've been fighting to resolve this problem for days! It almost gave me a nervous-breakdown once. As an example, the latest entry I tried to add was an entry for a Windows game (using Wine):

    [Desktop Entry]
    Name=Venus Patrol 1.1
    Icon=/usr/share/icons/venuspatrol.jpg
    Type=Application
    Categories=Game;
    Exec=wine "/home/LOL/Autres/ProgramFiles/Games/Venus Patrol 1.1/VENUS PATROL.exe"
    Path="/home/LOL/Autres/ProgramFiles/Games/Venus Patrol 1.1"
    Keywords=game;indie;jam;
    Terminal=true
    GenericName=Indie game by Neil Thapen originally made for TIGSource Cockpit Competition 2009
    

    I put directly executable programs and games (no installation needed, mainly Windows ones) in "/home/LOL/Autres/ProgramFiles" directory. I don't like messing with root folders, as I'm obliged to open the File Manager as root and go through all the system folders.

    Whether the path contains spaces or not, it does not work. Whether I precise the environement WINEPREFIX path or not, it does not work. I've tried Alacarte, but it doesn't work as well. I've been reading this, but it didn't help.

    Please, help me, I need some help. Do you have any ideas?

    PS: ... Well, yeah, I'm a fussy person

    EDIT: So, after Mr. Gruber's reply, I updated my .desktop file, without success:

    [Desktop Entry]
    Name=Venus Patrol 1.1
    Icon=/usr/share/icons/venuspatrol.jpg
    Type=Application
    Categories=Game;
    TryExec=/home/LOL/Autres/ProgramFiles/Games/Venus\sPatrol\s1.1/VENUS\sPATROL.exe
    Exec=wine "/home/LOL/Autres/ProgramFiles/Games/Venus Patrol 1.1/VENUS PATROL.exe"
    Path="/home/LOL/Autres/ProgramFiles/Games/Venus Patrol 1.1"
    Keywords=game;indie;jam;
    Terminal=true
    GenericName=Indie game by Neil Thapen originally made for TIGSource Cockpit Competition 2009.
    

    Whether I precise the Path variable or not, as ever, it does not work. It may be related to Wine (WINEPREFIX, this kind of things), as I (supposedly) eventually had the Exec field well written.

    • John S Gruber
      John S Gruber almost 12 years
      Does it help to use a complete path name for wine?
    • Karim
      Karim almost 12 years
      Eerrr, I can't do without, can I? If I don't, wine will search for the file in system32 folder and other Windows PATH folders.
    • John S Gruber
      John S Gruber almost 12 years
      I think you need the path for the .exe program. I think you need to add the path to where the wine program is. I've added an answer to try to make this clearer.
    • John S Gruber
      John S Gruber almost 12 years
      What happens if you start a terminal and try the part after the "="? /usr/bin/wine "/home/LOL/Autres/ProgramFiles/Games/Venus Patrol 1.1/VENUS PATROL.exe`
    • Karim
      Karim almost 12 years
      It does not work.
    • Karim
      Karim almost 12 years
      It does not work.
    • Karim
      Karim almost 12 years
      But, I mean, how do you guys do to manage your app menu entries?
    • kiri
      kiri over 10 years
      When creating my own .desktop files, I always use gnome-desktop-item-edit. For whatever reason, it never works without it.
  • Karim
    Karim almost 12 years
    Thanks!... But same result as ever: it does not work.
  • Karim
    Karim almost 12 years
    Indeed I successfully used '' and "", but it does not work. Precising the WINEPREFIX path does not change anything as well.
  • John S Gruber
    John S Gruber almost 12 years
    I've edited the answer with another attempt deriving from another recent question/answer. Perhaps that question would help you ... askubuntu.com/questions/175404/…
  • Karim
    Karim almost 12 years
    Thanks for your help! And, guess what: still does not work. Seriously, how do you guys do to sort your menu entries? I've updated my .desktop file, without success.
  • Karim
    Karim almost 12 years
    I updated my question too.