4

I've installed FTL: Faster Than Light on my girlfriend's Lubuntu machine and created a .desktop file for it. Strangely, the program won't launch via its menu entry under 'Games'.

If I navigate to /home/andi/.local/share/applications/ via pcmanfm and double click on FTL Faster Than Light.desktop the game launches without a problem. I know the menu entry is generated through the .desktop file so why won't it launch from the menu?

Here's the .desktop file I created: FTL Faster Than Light.desktop

3
  • I've also trying placing the .desktop file in /usr/share/applications with no difference.
    – Insperatus
    Dec 12, 2012 at 19:46
  • This will execute correctly if you run cd /home/andi/.local/share/FTL/; ./FTL I trust?
    – Alex L.
    Dec 12, 2012 at 21:00
  • @AlexL. Indeed it runs with that command
    – Insperatus
    Dec 13, 2012 at 7:44

4 Answers 4

6
+50

Based on your response to Alex L.'s comment, it sounds like FTL is looking for various things in your current working directory, so if you navigate using a filebrowser or using cd, it works. Since the menu doesn't do that, there's something that it can't find.

Try editing the .desktop file so the Exec line looks like this instead:

sh -c "cd /home/andi/.local/share/FTL/ && ./FTL"

That will switch directories first, and should let FTL find everything it needs to start.

6
  • Changed the exec line as you suggested but it didn't work.
    – Insperatus
    Dec 15, 2012 at 11:08
  • In fact that made the game unlaunchable even from the icon in pcmanfm.
    – Insperatus
    Dec 15, 2012 at 20:57
  • 2
    Probably because it is an invalid exec line. Try to wrap it up like this: sh -c "cd /home/andi/.local/share/FTL/ && ./FTL"
    – Timo
    Dec 15, 2012 at 21:03
  • I think tried using that exact line before - I know I tried using sh -c at least. I'll give it a go
    – Insperatus
    Dec 15, 2012 at 21:36
  • 1
    Edited the original answer to comply with Timo's advice. Thanks everyone!
    – Insperatus
    Dec 15, 2012 at 21:45
1

Paste the following into your text editor:

#!/bin/bash
cd /home/andi/.local/share/FTL/
./FTL
exit 0

Save it as FTL-launch in ~/bin/ and set it as executable. Then change the exec line in your .desktop file to

Exec=FTL-launch

This is, of course, based on ImaginaryRobots' answer; I've used similar launchers for some old windows games running in wine, where they need to be launched from within their directory.

If you don't have a ~/bin, you'll just have to create one - though then you may need to log out & log in again for it to work.

2
  • I will try as you suggested but I thought setting the Path=/home/andi/.local/share/FTL/ would take care of that? On Ubuntu 12.10 the launcher I made worked only after adding that line to the .desktop file.
    – Insperatus
    Dec 15, 2012 at 21:32
  • I'm sure your answer would have also worked but I prefer to keep it simpler if possible. The other answer provided a way to fix it within the .desktop file without creating an additional script. Thank you :)
    – Insperatus
    Dec 15, 2012 at 21:46
0

Did you install the desktop file? As far as I understand, desktop files need to be installed by doing,

sudo desktop-file-install myfile.desktop

Where, of course, myfile.desktop should be 'FTL Faster Than Light.desktop' in this case.

You could also try using alacarte (also called Main Menu), in which you can create launchers via a GUI.

4
  • 1
    desktop files put in ~/.local/share/applications will be found by the DE and are no different from those in /usr/...
    – Alex L.
    Dec 12, 2012 at 20:49
  • @PatricoClark I've created other .desktop files for games and applications in Lubuntu and never installed them - and they worked from the menu just fine. I'll give it a shot though and let you know.
    – Insperatus
    Dec 13, 2012 at 7:54
  • /usr/share/applications/FTL Faster Than Light.desktop: error: value "'/home/andi/.local/share/FTL/FTL'" for key "Exec" in group "Desktop Entry" contains a reserved character ''' outside of a quote /usr/share/applications/FTL Faster Than Light.desktop: error: value "'/home/andi/.local/share/FTL/FTL'" for key "Exec" in group "Desktop Entry" contains a reserved character ''' outside of a quote Error on file "FTL Faster Than Light.desktop": Failed to validate the created desktop file Maybe a clue
    – Insperatus
    Dec 13, 2012 at 8:12
  • 1
    Removed single quotes from line Exec='/home/andi/.local/share/FTL/FTL' in .desktop file and reran desktop-file-install FTL\ Faster\ Than\ Light.desktop which reported no error this ti\me. Unfortunately it is still not launching from the menu.
    – Insperatus
    Dec 13, 2012 at 8:22
0

You could try making the .desktop file executable. While it's not part of Lubuntu, I know that Nautilus will not run any non executable desktop files. Maybe Lubuntu's menu requires this as well.

Also, I would try removing the spaces from the file name of the .desktop file.

1
  • I also have tried making it executable but with no success. I thought about removing the spaces but seeing other .desktop files with spaces made me hesitate. I'll give it a go
    – Insperatus
    Dec 15, 2012 at 21:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .