Reputation: 1141
I typically write a shell script like this:
#!/bin/sh
nohup /path/to/myapp -test "$@" &
I can then launch this shell script from terminal and any command line arguments I give it are passed to the shell script which are then passed to the exec line myapp. I am using Ubuntu, and the issue is with shell script the icon of the launced up is not that of the shell file. It uses the default icon of the myapp. That's why I am moving to .desktop, it makes the launched app use the icon of the .desktop file.
I have written a .desktop file per:
[Desktop Entry]
Name=My Ro
Type=Application
Comment=Web Application
Exec=/path/to/myapp -test @
Icon=/opt/giteye/icon.xpm
Name[en_US]=My Ro
I put an @ sign on the exec line, but its not working as expected. It is not taking the command line arguments I give to the .desktop and its not putting it into the exec line. Can you please help me to pass the command line arguments received by the .desktop to the Exec line/
Upvotes: 3
Views: 6726
Reputation: 3829
What you want -- to open desktop files from the terminal with arbitrary arguments -- is not how .desktop files are used.
Only certain variables are allowed in the arguments, essentially corresponding to desktop-like actions: files to open, and so forth. If that's what you want, you may be able to do it using codes like %f
for a file, and then using the UI to drag a file onto the application, for example.
Another way to configure an application is to use Desktop Actions, which essentially are an enumerated list of ways to open an application. So if you have a well-defined set of arguments you want to use, that would work.
See the Desktop Entry specification for details on the argument codes and how desktop actions work.
Upvotes: 5