Results 1 to 9 of 9

Thread: .desktop file wont work and it's driving me insane!

  1. #1
    Join Date
    Apr 2020
    Location
    where the work takes me
    Beans
    163
    Distro
    Ubuntu 18.04 Bionic Beaver

    .desktop file wont work and it's driving me insane!

    Hello all,

    I've been trying for hours to get this desktop file to work and it's driving me round the bend...

    Code:
    [Desktop Entry]
    
    Name=Streets of Rogue
    Type=Application
    Path=/home/perrywinklesnoop/GOG\ Games/Streets\ of\ Rogue/game
    Exec=StreetsOfRogueLinux.x86_64
    Icon=/home/perrywinklesnoop/GOG\ Games/Streets\ of\ Rogue/support/icon.png
    Terminal=false
    I have tried the following


    • Installed to '~/Desktop' and '~/.local/share/applications' both by copying it in and also using the 'desktop-file-install' utility
    • Encapsulated the path in double quotes, both with and without the escaping backslashes
    • Same as above but for 'Icon'
    • Used the 'desktop-file-verify' utility to check for errors, which returns none at all
    • Ran 'update-desktop-database' for both '~/Desktop' and '~/.local/share/applications'
    • Tried with the .desktop file allowed as an executable, and also without (I think it should be without)
    • Tried running the .desktop file as software by using right click > run with program
    • Checked all paths are correct many times over


    Still no luck, the file wont even display the specified icon, it just sits on my desktop and any attempt to open it just opens it as a text file. The only other thing I can think to mention that may be relevant is that the game comes with a .sh script that is run to start it (apparently all Linux native games from GOG.com feature this) however after having it for a couple of days I realised there is an executable within the game files that works just fine, so no idea what that's about?

    My .desktop file points to the executable, although I originally tried pointing to the shell script with no luck. I don't know if this is somehow relevant...

  2. #2
    Join Date
    Jan 2006
    Location
    Sunny Southend-on-Sea
    Beans
    7,897
    Distro
    Kubuntu 18.04 Bionic Beaver

    Re: .desktop file wont work and it's driving me insane!

    Quote Originally Posted by jcdenton1995 View Post
    I've been trying for hours to get this desktop file to work and it's driving me round the bend...
    I think you need the full path to the executable in the Exec line. The Path line is for telling the executable where its files are rather than for finding the executable file in the first place. It's only if that file is in your $PATH that you wouldn't need it.

    Still no luck, the file wont even display the specified icon, it just sits on my desktop and any attempt to open it just opens it as a text file.
    Which desktop environment? Gnome has been trying to stop its users from putting files, and particularly .desktop files, on the Desktop for a while now. I think Dolphin (the KDE file browser) is also moving away from being able to use .desktop files.

    I realised there is an executable within the game files that works just fine, so no idea what that's about?
    If you want to see what the script does, you can just open it in a text editor. It's probably just setting environment variables.
    None but ourselves can free our minds

  3. #3
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    4,753

    Re: .desktop file wont work and it's driving me insane!

    You need the full path in the Exec= line.

    Example:
    Code:
    [Desktop Entry]
    Version=1.0
    Type=Application
    Name=Machinarium
    Comment=Machinarium
    Icon=/home/dmn/games/Machinarium/menu-icon-3a.png
    Exec=/home/dmn/games/Machinarium/Machinarium
    Path=/home/dmn/games/Machinarium
    NoDisplay=false
    Categories=Game;
    StartupNotify=false
    Terminal=false

  4. #4
    Join Date
    May 2010
    Beans
    555

    Re: .desktop file wont work and it's driving me insane!

    Why are you installing apps to $HOME ?
    Would you install applications in Windows to your "My Documents" folder?
    Seems messy

  5. #5
    Join Date
    Aug 2013
    Beans
    4,365

    Re: .desktop file wont work and it's driving me insane!

    Seems that putting .desktop file in ~/.local/share/applications no longer works for natulius in Ubuntu 20.04. I tried a few and click them, they never launch, just tried to open the file even though I made them executable. Maybe the result of gnome removing the ability to run scripts in Nautilus. I had to do something funny like dragging it to the dock and pin it and then unpin it for the .desktop launcher to show up in the dash (I use unity, but the .desktop file doesn't work inside nautilus has nothing to do with unity, same story in gnome shell)

    I solved the problem by using nemo as my file manager.
    Last edited by monkeybrain20122; July 30th, 2020 at 06:51 PM.

  6. #6
    Join Date
    Apr 2020
    Location
    where the work takes me
    Beans
    163
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: .desktop file wont work and it's driving me insane!

    Quote Originally Posted by CatKiller View Post
    Which desktop environment? Gnome has been trying to stop its users from putting files, and particularly .desktop files, on the Desktop for a while now. I think Dolphin (the KDE file browser) is also moving away from being able to use .desktop files.
    I'm using GNOME 3.36.3, it's a standard Ubuntu 20.04 LTS install, I copied a .desktop file from '/usr/share/applications' to "~/Desktop" and I could open that without any problems.

    I think there is something screwy going on, for example I managed to get the icon to display, however this was contingent upon 2 things...


    • 'Path' and 'Exec' must both either be within quotes or have the special characters back-spaced (as expected)
    • 'Icon' must not be within quotes and must not have it's special characters back-spaced (unexpected)


    If 'path' or 'Exec' are not formatted in the way stated above, likewise for 'Icon', then the icon will not show even if the path to 'Icon' is correct

    I also changed 'Exec' to the full path which I believe you are right to say it should be, but still no luck.

    I also did another test, I moved the .desktop file to '/usr/share/applications' to see if I could launch it from the applications panel, but when I click on the icon I get a message at the top of the screen telling me that

    ----------------------------------------------------------------------------------------------------------------

    Success! it literally occurred to me what the message I got when trying to launch the program from the applications panel meant as I was typing this post, you were right, I needed to include the full file path as 'Exec', also you have to right click the icon on the desktop and select 'allow launching', but the thing that had undermined both of the above was that for some reason I had added the file name to 'Path' when obviously it should only be the programs directory, which it was previously when 'Exec' was only the filename, but I had been playing around and hadn't managed to get all these 3 things correct at the same time.

    Still weird about the icon though. Thanks for the help!

  7. #7
    Join Date
    Apr 2020
    Location
    where the work takes me
    Beans
    163
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: .desktop file wont work and it's driving me insane!

    It's just where the install script put it because I didn't run it with root permissions, an interactive window did offer me the option to select an installation location but obviously it would only let me put it in my home directory, and I didn't want to run it as root because I don't run anything like that as root if I don't know what that would do.

    I thought about transferring it to /usr/games or something like that however because at the time I hadn't found the actual executable and was just running 'start.sh' to start the game, I wasn't sure what the effect would be if the script expected to find resources or the game (or anything really) in the locations the game was originally installed into.

  8. #8
    Join Date
    Aug 2013
    Beans
    4,365

    Re: .desktop file wont work and it's driving me insane!

    Quote Originally Posted by jcdenton1995 View Post
    I thought about transferring it to /usr/games or something like that however because at the time I hadn't found the actual executable and was just running 'start.sh' to start the game, I wasn't sure what the effect would be if the script expected to find resources or the game (or anything really) in the locations the game was originally installed into.
    No, installing in $HOME is fine and it is the preferred way. I avoid sudo as much as possible for third party apps only for me (I am the only user other than root). There is no reason whatsoever to install these apps in the system's file system to pollute it. e.g it may create problems if your app dumps a lot of lib files in your file system and doesn't get cleanly uninstalled if you later try to remove it.

    You can create a bin folder in your $HOME (either ~/bin or ~/.local/bin) and then make a symlink of your executable to it, then it is in your $PATH (need to logout and login if the bin folder didn't exist before)
    Last edited by monkeybrain20122; July 30th, 2020 at 08:54 PM.

  9. #9
    Join Date
    Jan 2006
    Location
    Sunny Southend-on-Sea
    Beans
    7,897
    Distro
    Kubuntu 18.04 Bionic Beaver

    Re: .desktop file wont work and it's driving me insane!

    Quote Originally Posted by jcdenton1995 View Post
    Still weird about the icon though.
    There's a command that I can't remember off the top of my head for refreshing the cache of icons used for launchers, but I believe logging out and logging back in has the same effect. You can either specify the full path, in which case that file gets used, or you can just specify the name (and you don't need the extension) and the desktop environment will attempt to find a matching icon from your icon theme.
    None but ourselves can free our minds

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •