01micko: delete params on Exec line

The script /usr/local/petget/installpkg.sh has code to delete extra parameters prefixed with "%" on the "Exec=" line in .desktop files.
For example "Exec=gimp %U" will have the "%U" deleted.

It seems that Billtoo has reported a problem with this, and 01micko has proposed alternate code:

...which is a bit of a problem for me, as I can't see anything wrong with my code, and I don't have the explicit example of when it "goes wrong".
However, I have implemented 01micko's change. It will be in the next upload of Woof.

01micko posted a useful reference on these extra parameters:

Posted on 15 Oct 2012, 9:15


Posted on 15 Oct 2012, 17:15 by 01micko
the offender
Hi Barry

The offender is kdegames, in both Precise and Slacko. An example entry:

Exec=bomber -caption "%c"

for the bomber game. Most of the games are the same. As you can see, you would be left with a stray quote and the game fails to start. Leaving the --caption "%c" does no harm, just puts the "%c" in the title bar of the window. No big deal. There are probably other KDE apps that follow this weird trend.

Posted on 15 Oct 2012, 18:06 by BarryK
Re the offender
Would 'bomber' still start ok if '-caption "%c"' was completely removed?

01micko, note, in your post you have shown -caption and --caption. Which one is correct?

I could modify my single-line sed operation to remove that also, but I wonder if any other kdegames have different commandline options that would also need removing.

I wonder if we could always assume that "Exec=" line will only have a one-word executable, chop off all parameters? Maybe that would break some apps, but I don't know of any.

Posted on 15 Oct 2012, 20:40 by 01micko
one dash
Yeah, sorry, one dash, -caption "%c"

Your idea would probably would break something like seamonkey -mail (if any distro actually uses that and not a wrapper script.. yep, Slackware does, just checked).

Posted on 15 Oct 2012, 20:49 by 01micko
here's a kde list
I just grepped "^Exec" in my slackware install in /usr/share/aplications/kde;

accountwizard.desktop:Exec=accountwizard --package %u

akregator.desktop:Exec=akregator %i -caption "%c"
amarok_containers.desktop:Exec=amarok %U
amarok.desktop:Exec=amarok %U
ark.desktop:Exec=ark -caption "%c" %U
blogilo.desktop:Exec=blogilo %i -caption "%c"
bluedevil-audio.desktop:Exec=bluedevil-audio %U
bluedevil-input.desktop:Exec=bluedevil-input %U
bluedevil-network-dun.desktop:Exec=bluedevil-network-dun %U
bluedevil-network-panu.desktop:Exec=bluedevil-network-panu %U
bluedevil-sendfile.desktop:Exec=bluedevil-sendfile -k%U
bluedevil-wizard.desktop:Exec=bluedevil-wizard %U
bomber.desktop:Exec=bomber -caption "%c"
bovo.desktop:Exec=bovo -caption "%c"
braindump.desktop:Exec=braindump %u
calligra.desktop:Exec=khelpcenter help:/calligra
cantor.desktop:Exec=cantor %i -caption "%c"
cervisia.desktop:Exec=cervisia -caption "%c" %i %u
dbpedia_references.desktop:Exec=krubyapplication dbpedia_references/dbpedia_references.rb
dolphin.desktop:Exec=dolphin %i -caption "%c" %u
dragonplayer.desktop:Exec=dragon %u
filelight.desktop:Exec=filelight %f
flow.desktop:Exec=calligraflow %u
gwenview.desktop:Exec=gwenview %U -caption "%c" %i
Home.desktop:Exec=kfmclient openProfile filemanagement
juk.desktop:Exec=juk -caption "%c" %i
k3b.desktop:Exec=k3b %U
kaddressbook.desktop:Exec=kaddressbook %u
kalarm.desktop:Exec=kalarm -caption "%c" %i
kalzium.desktop:Exec=kalzium -caption "%c" %i
karbon.desktop:Exec=karbon %u
kate.desktop:Exec=kate -b %U
katomic.desktop:Exec=katomic -caption "%c"
kbattleship.desktop:Exec=kbattleship -caption "%c" %U
kblackbox.desktop:Exec=kblackbox -caption "%c"
kblocks.desktop:Exec=kblocks -caption "%c"
kbounce.desktop:Exec=kbounce -caption "%c"
kbreakout.desktop:Exec=kbreakout -caption "%c"
kbruch.desktop:Exec=kbruch -caption "%c" %i
kcachegrind.desktop:Exec=kcachegrind -caption "%c" %u
kcalc.desktop:Exec=kcalc -caption "%c"
KCharSelect.desktop:Exec=kcharselect -caption "%c"
kdesnake.desktop:Exec=ktron -snake -caption "%c" %i

I wonder if it will fit in one post? (Nope!)

Posted on 16 Oct 2012, 5:33 by technosaurus
.desktop files
I've been meaning to fix this for a while in jwm_tools. Here is the spec:

%i should be replaced with --icon followed by the entry in Icon=

%c should be replaced with the translated name

%k should be replaced with the location of the desktop file

except %k these are already available as variables in jwm_menu_create, so its just a matter of:
EXEC=${EXEC//%i/--icon $ICON}

These may be useful in dialog frontends using gtkdialog, Xdialog, ...

jwm doesn't support drag 'n drop, so the rest can be dropped

Posted on 16 Oct 2012, 5:38 by technosaurus
re: .desktop files
that should have been:
EXEC=${EXEC//\%i/--icon $ICON}

(missed a few backslashes - otherwise it only replace the last c, i or k and not the %)