#.desktop file not working, why?

42 messages · Page 1 of 1 (latest)

delicate sentinel
#

I made a launch script that changes window focus mode to click before starting War Thunder. Now I'm trying to add it to the menu because well that would be nice. I created a .desktop file (attached), put it in ~/.local/share/applications/, and ran chmod 755 on it. In that same folder I found a .desktop file installed by the War Thunder installer and one for the builtin Matrix client.

Neither my .desktop file, nor the one made by War Thunder show up in the menu, but the Matrix client does. When I open them in the file browser, the War Thunder files pop up and say There was an error launching the application., then give up, but the Matrix one complains about being an untrusted launcher. What's wrong with my .desktop file?

finite fossil
delicate sentinel
#

It does not work when launched from file browser and it does not show in the Mint menu, not sure why it would be on my desktop..?

finite fossil
delicate sentinel
#

Oh no I don't want it on my desktop at all. The script itself does work, I can launch it with Alt+F2, but the .desktop file doesn't work.

#

.desktop files are how you're supposed to put things in the start menu, they don't actually relate to what's shown on your desktop

delicate sentinel
#

that's... entirely beyond the point of my question

#

I made the .desktop file so it would show up in the start menu

#

it doesn't show up in the menu and launching the .desktop file directly doesn't work

#

WHY

delicate sentinel
#
  1. That puts it in the menu and on the desktop.
  2. It makes a .desktop file in the same place I put mine.
  3. It still doesn't explain why my file doesn't work.

What is wrong with my file?

finite fossil
#

so have you tried it?

delicate sentinel
#

yeah it works

#

But it does not answer my question

finite fossil
delicate sentinel
#

it's already there

#

what is wrong with MY FILE?

finite fossil
#

the exact same file?

#

as you created with right click?

delicate sentinel
#

no it's very very different

finite fossil
#

well then I'm not sure what I don't understand

delicate sentinel
#

I don't just need a menu entry

#

I need to know why my menu entry (the one I wrote) is broken

finite fossil
#

because you wrote it incorrectly

delicate sentinel
#

ok which part

finite fossil
#

it seems it works now, please mark as solved

delicate sentinel
#

not solved what part did I write incorrectly

finite fossil
#

the file

delicate sentinel
#

which
part
of
the
file

finite fossil
#

[Desktop Entry] Encoding=UTF-8 Version=1.0 Type=Application Terminal=false Exec=$HOME/.local/bin/warthunder-click Name=War Thunder (focus-mode 'click') Icon=$HOME/.local/bin/WarThunder/launcher.ico Categories=Games

#

good night, mark as solved if solved

#

here's how it should be like

Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Exec=/home/yourusername/.local/bin/warthunder-click
Name=War Thunder (focus-mode 'click')
Icon=/home/yourusername/.local/bin/WarThunder/launcher.ico
Path=/home/yourusername/.local/bin/WarThunder
Categories=Games```
#

using $HOME might not work especially when ran with weird permissions

delicate sentinel
#

so in order to share this in a GitLab repo I need to ask all users to edit the file and fill in their own usernames?

delicate sentinel
#

when somebody downloads it and their username is joebob then /home/aweso ain't gonna work

finite fossil
#
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Exec=bash -c "$HOME/.local/bin/warthunder-click"
Name=War Thunder (focus-mode 'click')
Icon=bash -c "$HOME/.local/bin/WarThunder/launcher.ico"
Path=bash -c $HOME/.local/bin/WarThunder
Categories=Games```
#

that should work, with bash -c

delicate sentinel
#

ehh, invoking bash with the icon isn't going to work but I edited mine to remove the $HOME and it works now, thank you

finite fossil
#

you're right, but not sure what else to do then