NAME

urlopener_remote - weechat script to open urls on a remote host

DESCRIPTION

this script can help you to open urls on a local host when running weechat remotely. however, such setup is not the most trivial. PLEASE READ:

SETUP

it requires a three stage setup. on the weechat installation, just load the script as usual, i.e. by

  /perl load urlopener_remote.pl

on the local computer, you will need to set up an url opening daemon, which can be done quite easily if you have "netcat" (sometimes also called "nc") installed. in a terminal window, run

  while true; do xdg-open $(netcat -l -p 23337); done&

if you only have perl, things look a bit more awkward but something like this should do:

 perl -MSocket -E'socket my$s,PF_INET,SOCK_STREAM,getprotobyname"tcp";
                 setsockopt$s,SOL_SOCKET,SO_REUSEADDR,pack"l",1;
                       bind$s,sockaddr_in(23337,INADDR_LOOPBACK);
                     listen$s,SOMAXCONN;
          for(;accept my$c,$s;close$c)
                   {$_=<$c>;chomp;fork==0&&exec"xdg-open",$_}'&

now connect to your weechat on a remote server using the following command:

  ssh -R 23337:localhost:23337 -t YOUR.SSH.SERVER.ADDRESS

the important part here is to connect the ports using the -R switch. if you now click on a url using the "coords.pl" script, it will get sent to the netcat above and opened with xdg-open (which is hopefully your favourite web browser)