Older versions of Netscape and Mozilla (for X11) supported the so-called remote protocol: it was possible to open a URL or start composing an e-mail whenever a Netscape/Mozilla window (not necessarily from a local process) was open on the current DISPLAY.

The "remote" feature worked either way: either from a remote client to a local browser, or vice versa, or even from a remote host1 to a remote host2, provided both could connect to the local DISPLAY.

Here's the documentation for:

Rudimentary support for remote requests has been preserved in SeaMonkey, too, so even nowadays it supports arguments like openURL(%url%,new-tab) and openURL(%url%,new-window)

Now, I want to create a custom *desktop file which would launch SeaMonkey with exactly those arguments.

The problem is, in this form:

[Desktop Entry]
Exec=seamonkey %u

%u expansion works, while in this one:

[Desktop Entry]
Exec=seamonkey -remote openURL(%u)

it doesn't: %u gets expanded only if it's surrounded with spaces.

The desktop entry specification doesn't mention this, so this is both an undocumented and unexpected behaviour.

Can you suggest any workaround?

3 Answers 3


I cannot say anything about the specification but as far as just the result matters I (not being familiar with the quoting in such files, though) would expect this to work:

Exec=bash -c 'echo seamonkey openURL"($1)"' seamonkey-wrapper %u%
  • This is a clever solution, except that it doesn't work, either, because the specification has completely mind-blowing escaping and quotation rules not followed by xdg-open. Looking at xdg-open source code, I wonder whether this piece of ... software has actually undergone any testing.
    – Bass
    May 29, 2020 at 15:50
  • 1
    @Bass If you find out what the arguments are when the process is called then we may get that "fixed". You could use strace or perhaps a wrapper script Exec=/wrapper/script.sh ... which just does this: a=("$@"); declare -p a >/log/file May 29, 2020 at 15:57
  • Thank you. I can write a wrapper script which can do whatever I want and even make me a coffee. But I'd be happier if the developers of xdg-utils did their job and fixed their own code. Filed bugs #173 and #174.
    – Bass
    May 29, 2020 at 16:45

I just had this problem recently and there is a specification. here

If the % is for the application, you need to put %%. That is for the future, when creating a .desktop file for youtube-dl and using the --output option. In your case you probably need to escape the braces. \(\), because the shell evaluates them. Set the option terminal=true, you will see an error about/at (.

Or try: seamonkey 'openURL(%u)' seamonkey "openurl\$'0028'%u\$'0029'"

Beware! I use to have problems with ', while " works. But only ' means literal without any interpretation/expansion. IIRC, you do not need to put quote the variable, as it will already be quoted.

  • Thank you, but your suggestions only apply to POSIX shell, not for xdg-open adn *.desktop files. As I said, the problem is not parentheses being misinterpreted by the shell but, instead, %u not expanded (which seems an undocumented limitation of xdg-open). Unfortunately, none of your recipes work for me.
    – Bass
    May 29, 2020 at 14:40
  • That doesn't make much sense. Neither did you mention xdg-open, nor is it a shell. But the xdg-open command/script will be executed in one. POSIX has nothing to do with it. My solution should work, but i am not on my PC and i dont care. My answer just clearifies.
    – WGRM
    May 29, 2020 at 16:06
  • 1
    The question has been originally tagged xdg-open. Second, %u expansion only makes sense in the context of xdg-open. Third, the question has a link to the desktop file specification. So I though it was perfectly clear what the question was about.
    – Bass
    May 29, 2020 at 16:30
  • Got me there. I usuay dont look at the tags. I'd say many dont do and expect everything within the post. Anyway, let me give you one thing on your way; xdg-open is the terminal binary/script. The desktop environment implements the xdg standard itself, thats what the specification is for. So, your question is about .desktop files and that to what the variables belong.
    – WGRM
    May 30, 2020 at 17:06

The variable pattern usage with leading and trailing percentage characters looks very DOS-ish to me, the references freedesktop specification document only mentions leading characters.

According to the documentation of the Mozilla Remote Control option, the command openURL is an argument to the option -remote. Running the Exec command line from shell does not work without this option. Tested successfully with seamonkey 2.49.5 on fedora.

Mind to try out Exec=seamonkey -remote openURL(%u)?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .