3

I have a .desktop file that launches an app, and it uses the .desktop icon:

[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 want to use a shell script instead to launch this app because with shell script i can pass the script command line arguments which then get passed to the launching app.

#!/bin/sh
nohup /path/to/myapp -test "$@" &

However with shell script the icon is not that of the shell file. It uses the default icon of the myapp. Is there anyway to make this behave as the .desktop and make the shell launch the app with custom icon?

EDIT - I tried giving the desktop entry path to shell

One desktop entry:

[Desktop Entry]
Name=Firefox
Type=Application
Comment=Web Application
Exec=/home/yasir/Desktop/launchers/Mozilla\ Firefox\ -\ test.sh
Icon=/home/yasir/Desktop/customFx.png
Name[en_US]=Firefox

Another desktop:

[Desktop Entry]
Name=Firefox Safe Mode
Type=Application
Comment=Web Application
Exec=/home/yasir/Desktop/launchers/Mozilla\ Firefox\ -\ test.sh -safe-mode
Icon=/home/yagt/Documents/fxSafe.png
Name[en_US]=Firefox Safe Mode

Shell:

#!/bin/sh
nohup /usr/lib/firefox/firefox "$@" &
yatg
  • 131
  • 2

1 Answers1

1

There arises no reason to do this. That's exactly why it is not possible. If you are going to pass arguments other than the arguments allowed, then you will be invoking it from a command line, in which case there is not reason to have an icon. In that case, you wont be using a .desktop file, but a script directly.

Add...  Accepts...
%f  a single filename.
%F  multiple filenames.
%u  a single URL.
%U  multiple URLs.
%d  a single directory. Used in conjunction with %f to locate a file.
%D  multiple directories. Used in conjunction with %F to locate files.
%n  a single filename without a path.
%N  multiple filenames without paths.
%k  a URI or local filename of the location of the desktop file.
%v  the name of the Device entry.

These are the allowed arguments, which are passed from within the GUI, like for example, by dragging a file to the .desktop file.

Here is an example usage.

daltonfury42
  • 5,559