6
Exec=sh -c "some command' %k

No info in man sh and man exec on %k.
What does %k mean here?

Michael Homer
  • 74,824
  • 17
  • 212
  • 233
showkey
  • 79
  • 23
  • 67
  • 128

1 Answers1

6

According to the Desktop Entry Specifications:

%k The location of the desktop file as either a URI (if for example gotten from the vfolder system) or a local filename or empty if no location is known.

What is not obvious from your example at first sight is that sh -c '...' (if that is POSIX /bin/sh and not symlinked to csh) sets positional arguments starting at $0, which means $0 will be whatever is %k.

Sergiy Kolodyazhnyy
  • 16,187
  • 11
  • 53
  • 104
  • 1
    No system would be foolish enough to have a sh -> csh symlink. However some old ksh88-based `sh` implementations have been known to put the first argument after the inline script in `$1` instead of `$0`, which is why you sometimes see things like `sh -c 'code "$1"' arg arg` or `sh -c 'shift "$1"; code ${1+"$@"}' 2 1 args...`. Those shouldn't be needed anymore nowadays. Note that `$0` is not a positional argument per se. – Stéphane Chazelas Apr 30 '18 at 09:18