I have a application which uses "self-restart" mechanism. It kills itself and runs again. When I run it first time (with .desktop file) it loads its icon correctly. The problem is that when it restarts itself, it runs its binary and not the .desktop file. The result is that it does not load the icon. I was thinking about sending the path to .desktop as an argument of the application and running that instead of the binary.

I would like to ask if it is possible to use the path to .desktop file as the argument for my application inside the same .desktop file.

Or is there a another way that will keep the icon loaded?

I would like to achieve something like this:

[Desktop Entry]
Exec=myBinary *PathToThisDesktopFile*
  • Could you give us a use case scenario? I can't imagine why you would want to do this. What binary would you want to run on the .desktop file itself? – terdon Sep 24 '14 at 11:45
  • @terdon I've edited the quesiton. – user3840048 Sep 24 '14 at 11:47
  • OK, this sounds like a classic XY problem. Please edit some more and explain exactly where you see this icon, what kind of application you have etc. Make it clear that your objective is to have your icon appear/load whatever, no matter how your application is launched. I'm fairly certain that fiddling with the .desktop file's path is not the way to do it. – terdon Sep 24 '14 at 11:58
  • @terdon Done. I hope it's ok now. – user3840048 Sep 24 '14 at 12:09

Might be helpful (a snippet from netbeans launcher):

~> cat ~/.local/share/applications/netbeans-8.0.desktop|grep Exec
Exec=/bin/sh "/home/ipip/opt/netbeans-8.0/bin/netbeans"
  • That does not solve/show anything... – user3840048 Sep 24 '14 at 17:10
  • Oh, I see now... I answered a completley different question :-) – Iľja Jun 23 '16 at 16:00
  • Then, you'll have to tell the application, not to start its binary but the .desktop file. I'm pretty sure, it determines it's path and executable from some environment variables or argv, so putting reference to .desktop file to the Exec enty is probably not the way. – Iľja Jun 23 '16 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.