site  contact  subhomenews

01micko: delete params on Exec line

October 15, 2012 — BarryK
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:
http://murga-linux.com/puppy/viewtopic.php?t=76961&start=720

...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:
http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s06.html

Comments

the offender
Username: 01micko
Hi Barry The offender is kdegames, in both Precise and Slacko. An example entry: [i]Exec=bomber -caption "%c"[/i] 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 [i]--caption "%c"[/i] 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.

Re the offender
Username: BarryK
"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.

one dash
Username: 01micko
"Yeah, sorry, one dash, [i]-caption "%c"[/i] Your idea would probably would break something like [i]seamonkey -mail[/i] (if any distro actually uses that and not a wrapper script.. yep, Slackware does, just checked).

here's a kde list
Username: 01micko
"I just grepped "^Exec" in my slackware install in /usr/share/aplications/kde; [code]accountwizard.desktop:Exec=accountwizard --package %u akonadiconsole.desktop:Exec=akonadiconsole akonaditray.desktop:Exec=akonaditray akregator.desktop:Exec=akregator %i -caption "%c" amarok_containers.desktop:Exec=amarok %U amarok.desktop:Exec=amarok %U amor.desktop:Exec=amor ark.desktop:Exec=ark -caption "%c" %U blinken.desktop:Exec=blinken blogilo.desktop:Exec=blogilo %i -caption "%c" bluedevil-audio.desktop:Exec=bluedevil-audio %U bluedevil-input.desktop:Exec=bluedevil-input %U bluedevil-monolithic.desktop:Exec=bluedevil-monolithic 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 Help.desktop:Exec=khelpcenter Home.desktop:Exec=kfmclient openProfile filemanagement juk.desktop:Exec=juk -caption "%c" %i k3b.desktop:Exec=k3b %U kaddressbook.desktop:Exec=kaddressbook %u kaddressbook-mobile.desktop:Exec=kaddressbook-mobile kalarm.desktop:Exec=kalarm -caption "%c" %i kalgebra.desktop:Exec=kalgebra kalgebramobile.desktop:Exec=kalgebramobile kalzium.desktop:Exec=kalzium -caption "%c" %i kanagram.desktop:Exec=kanagram kapman.desktop:Exec=kapman kapptemplate.desktop:Exec=kapptemplate karbon.desktop:Exec=karbon %u kate.desktop:Exec=kate -b %U katomic.desktop:Exec=katomic -caption "%c" kaudiocreator.desktop:Exec=kaudiocreator 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" kcolorchooser.desktop:Exec=kcolorchooser kdepasswd.desktop:Exec=kdepasswd kdesnake.desktop:Exec=ktron -snake -caption "%c" %i [/code] I wonder if it will fit in one post? (Nope!)

.desktop files
Username: technosaurus
"I've been meaning to fix this for a while in jwm_tools. Here is the spec: http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s06.html %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//%c/$NAME} EXEC=${EXEC//%i/--icon $ICON} EXEC=${EXEC//%k/$APP_PATH} EXEC=${EXEC//\%?/} These may be useful in dialog frontends using gtkdialog, Xdialog, ... jwm doesn't support drag 'n drop, so the rest can be dropped

re: .desktop files
Username: technosaurus
"that should have been: EXEC=${EXEC//\%c/$NAME} EXEC=${EXEC//\%i/--icon $ICON} EXEC=${EXEC//\%k/$APP_PATH} EXEC=${EXEC//\%?/} (missed a few backslashes - otherwise it only replace the last c, i or k and not the %)


Tags: woof