Target Path in .desktop shortcuts?

Hi! I’m trying to add shortcuts to launch scripts for various game mods (IW4x, Ship of Harkanian) to my application menu in Bazzite.
One mod is an extension-less script and the other is an AppImage.
I created a .desktop shortcut and got it added to my Menu.
Example:

[Desktop Entry]
Type=Application
Terminal=false
Name=Ocarina of Time (Ship of Harkanian)
Icon=/home/addie/icons/ocarina.png
Exec="/home/addie/Games/Ship_of_Harkanian/soh.appimage"

The problem is, it launches the script/appimage somehow separate from its source folder, which breaks the program.
I found the “Path” variable from the Arch wiki, so I added a line of

Path="/home/addie/Games/Ship_of_Harkanian"

But now I get an error about “WorkingDirectory= expects an absolute path or ‘~’”.
I tried removing the path from the exec location so it was just path, then exec=filename, but then it couldn’t find the file at all.
I feel like I’m very close to getting this working, but I can’t figure out why the working Path option is broken.
Any advice?

Bazzite Linux.

Here’s the current state of my two .desktop files:
1

[Desktop Entry]
Type=Application
Terminal=true
Name=MW2-iW4x
Icon=/home/addie/icons/mw2.png
Exec="/var/home/addie/.local/share/Steam/steamapps/common/Call of Duty Modern Warfare 2/alterware-launcher"
Path="/var/home/addie/.local/share/Steam/steamapps/common/Call of Duty Modern Warfare 2/"
Name[en]=MW2-iW4x
Name[en_US]=MW2-iW4x
Name[en_US.UTF-8]=MW2-iW4x
Categories=Game
Hidden=false
NoDisplay=false
StartupNotify=false

2

[Desktop Entry]
Type=Application
Terminal=false
Name=Ocarina of Time (Ship of Harkanian)
Icon=/home/addie/icons/ocarina.png
Exec="/home/addie/Games/Ship_of_Harkanian/soh.appimage"
Path="/home/addie/Games/Ship_of_Harkanian"
1 Like

It might be as stupid as ‘absolute path needs trailing slash /’.

K3n.

1 Like

SOLVED!
So the problem is twofold:

  1. I need the Path=path as I expected
  2. Exec= needs to have quotes for a directory with spaces, but Path= needs to NOT have spaces.
    So this works:
[Desktop Entry]
Type=Application
Terminal=true
Name=MW2-iW4x
Icon=/home/addie/icons/mw2.png
Exec="/var/home/addie/.local/share/Steam/steamapps/common/Call of Duty Modern Warfare 2/alterware-launcher"
Path=/var/home/addie/.local/share/Steam/steamapps/common/Call of Duty Modern Warfare 2/
Name[en]=MW2-iW4x
Name[en_US]=MW2-iW4x
Name[en_US.UTF-8]=MW2-iW4x
Categories=Game
Hidden=false
NoDisplay=false
StartupNotify=false

Thanks to marlop352 on BlueSky for figuring it out for me.

1 Like