xdg-open fails to process a quoted argument with spaces and splits it instead
There appears to be a workaround for issue #173: use bash -c
as a wrapper and pass the last argument (%u
in our example) to it as $1
(see this answer for details). Okay, xdg-open
has an undocumented limitation noone has thought of in the first place, but we can deal with it.
In theory this would look like this:
[Desktop Entry]
Exec=bash -c 'seamonkey -remote openURL($1,new-tab)' seamonkey-wrapper %u
Here, bash
will name the shell seamonkey-wrapper
and eventually execute
seamonkey -remote openURL(%u,new-tab)
with %u
already expanded by xdg-open
.
The specification prescribes that double quotes should be escaped, and whatever is to be quoted should be quoted.
The problem is, I can't get this to work. No matter how exactly I escape and/or quote my arguments:
Exec=bash -c "seamonkey -remote openURL($1,new-tab)" seamonkey-wrapper %u
Exec=bash -c \"seamonkey -remote openURL($1,new-tab)\" seamonkey-wrapper %u
Exec=bash -c 'seamonkey -remote openURL($1,new-tab)' seamonkey-wrapper %u
Exec=bash -c \'seamonkey -remote openURL($1,new-tab)\' seamonkey-wrapper %u
-- I can't pass seamonkey -remote openURL($1,new-tab)
as a single quoted argument to bash
, w/o xdg-open
splitting it into three tokens.