is palemoon -remote supported ?

Users and developers helping users with generic and technical Pale Moon issues on all operating systems.

Moderator: trava90

Forum rules
This board is for technical/general usage questions and troubleshooting for the Pale Moon browser only.
Technical issues and questions not related to the Pale Moon browser should be posted in other boards!
Please keep off-topic and general discussion out of this board, thank you!
Lucio Chiappetti
Astronaut
Astronaut
Posts: 654
Joined: 2014-09-01, 15:11
Location: Milan Italy

is palemoon -remote supported ?

Unread post by Lucio Chiappetti » 2018-10-23, 12:57

I have a wrapper script invoked by my mail user agent which should display an URL contained in a mail message in a new palemoon tab. It used to work with PM 25, but it is not listed in palemoon -help for PM 28. In a nutshell the wrapper did a test whether PM is running (which usually is), if so loads the URL in "remote", if not fires a browser and exits

Code: Select all

palemoon -remote "ping()" >& /dev/null
if ( $status == 0) then
    palemoon -remote "openURL($1)"
else
    (palemoon $1) &
endif
Apparently palemoon -remote is not documented, it works in openURL but not in ping mode. What is the proper replacement syntax for the above behaviour ?
The reasonable man adapts himself to the world: the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man. (G.B. Shaw)

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2183
Joined: 2018-05-05, 13:29

Re: is palemoon -remote supported ?

Unread post by vannilla » 2018-10-23, 14:21

Maybe you could grep for the browser in the output of "ps -e"?

Code: Select all

ps -e | grep palemoon > /dev/null
if [[ "$?" == "0" ]]; then
    palemoon -remote "openURL($1)"
else
    palemoon $1 &
fi
This is for bash, adapt it to whatever shell you are using.

Edit:
Sorry, completely misread part of your post, so my answer isn't actually that helpful. Still, the solution is valid if you can run ps, etc. so I'm leaving it here.
Last edited by vannilla on 2018-10-23, 14:23, edited 1 time in total.

Lucio Chiappetti
Astronaut
Astronaut
Posts: 654
Joined: 2014-09-01, 15:11
Location: Milan Italy

Re: is palemoon -remote supported ?

Unread post by Lucio Chiappetti » 2018-10-23, 14:37

Of course the solution is valid, though less elegant than -remote ping().
My question is actually twofold, i.e. whether -remote ping() is still a valid syntax or has a replacement, and whether -remote in general is still necessary or now redundant.

I am trying to debug the invocation of palemoon from my MUA after a general system upgrade
The reasonable man adapts himself to the world: the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man. (G.B. Shaw)

Walter Dnes
Astronaut
Astronaut
Posts: 650
Joined: 2015-07-30, 20:29
Location: Vaughan, ON, Canada

Re: is palemoon -remote supported ?

Unread post by Walter Dnes » 2018-10-23, 21:03

I believe that --remote is the default, and not even listed as an option. You have to use --no-remote to disable it. I think your problem is that openURL does not appear to be supported, let alone required.

palemoon "openURL(https://www.youtube.com)" & fails

palemoon "https://www.youtube.com" & works

You probably want palemoon "$1" & in your script.
There's a right way
There's a wrong way
And then there's my way

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2183
Joined: 2018-05-05, 13:29

Re: is palemoon -remote supported ?

Unread post by vannilla » 2018-10-23, 22:21

I experimented a couple of times, out of curiosity.
Running

Code: Select all

palemoon -remote "ping()"
returns immediately with $? equal to 1.

Code: Select all

palemoon -remote "openURL(http://gentoo.org)
hanged for a bit, then opened the Gentoo website in my running instance (note that I used http, not https, though it probably simply redirected me).
MDN lists -remote as a valid (but deprecated) option, but doesn't list the commands or anything useful.

Walter Dnes
Astronaut
Astronaut
Posts: 650
Joined: 2015-07-30, 20:29
Location: Vaughan, ON, Canada

Re: is palemoon -remote supported ?

Unread post by Walter Dnes » 2018-10-24, 11:12

What's the difference between the two commands to justify the extra keystrokes in the first version?

Code: Select all

palemoon -remote "openURL(http://gentoo.org)" &
palemoon "http://gentoo.org" &
There's a right way
There's a wrong way
And then there's my way

Lucio Chiappetti
Astronaut
Astronaut
Posts: 654
Joined: 2014-09-01, 15:11
Location: Milan Italy

Re: is palemoon -remote supported ?

Unread post by Lucio Chiappetti » 2018-10-24, 12:45

The commands were derived from an earlier version of palemoon, in turn derived from an earlier version of firefox, in turn probably from an even earlier version of mozilla or netscape. At the time is was important (or deemed so in the instructions of my MUA) to proceed as follows:

if a browser is already running (-remote ping returns zero) then open url in new tab of existing browser instance (-remote openUrl)
else start the browser afresh

Now I must admit that I usually have the browser permanently running, but I kept the scripts for backward compatibility
The reasonable man adapts himself to the world: the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man. (G.B. Shaw)

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2183
Joined: 2018-05-05, 13:29

Re: is palemoon -remote supported ?

Unread post by vannilla » 2018-10-24, 15:50

Walter Dnes wrote:What's the difference between the two commands to justify the extra keystrokes in the first version?

Code: Select all

palemoon -remote "openURL(http://gentoo.org)" &
palemoon "http://gentoo.org" &
MDN says that -remote works only under the X Window System, so it's likely something left over from something using some parts of the X protocol, then removed.
Anyway, looking at the browser's code through xref, it seems that "ping" isn't a supported command.
What's defined is: "openurl", "openfile" (which is an alias for openurl) and "xfedocommand(openbrowser)" (written that way), which seems to simply open a new window.

Locked