💾 Archived View for rkta.srht.site › irssi-openurl-ssh.gmi captured on 2024-02-05 at 09:31:55. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-12-28)
-=-=-=-=-=-=-
Blog[0] About[1] RSS[2] Links[3]
2018-12-27
Running irssi in a tmux session on a remote server I had the problem to open urls in GUI browser. Using openurl.pl lets me easily open urls from within irssi in w3m. As irssi is running on a remote server with out X this seemed quite reasonable, but sometimes you just need a more modern approach -- JavaScript, Video etc pp.
Searching for a solution I found this[4] tutorial how to setup openurl to write to a FIFO and to read from it with a shell script.
As I liked opening the URL first in w3m and hence w3m has a command to open the current url in an external browser with 'M' I decided to modify above solution to have w3m write to the FIFO.
First create the FIFO on the remote machine:
$ mkfifo ~/.w3m/url-pipe
Then open w3m on the remote machine, press 'o' and then go to the first link [External Viewer Setup], scroll down to find the 'External Program Settings' section.
Clear all external browser settings and configure the first option to use
echo '%s' > ~/.w3m/url-pipe
Navigate to the next [OK] and press enter to save your changes.
Create a shell script, I called it w3m-url-consumer.sh:
#!/bin/bash ssh -n $HOSTNAME "tail -f ~/.w3m/url-pipe" | while read url; do sensible-browser "$url"& done > /tmp/garbish
Replace $HOSTNAME with the actual hostname of your server. Create some autostart thingy for it or make sure it is running when you need it.
Hint: Inside irssi use
/set openurl_app_http tmux split-window w3m "$1"
to open w3m in a split pane.
Last modified: 2023-11-15T13:37:37Z E-mail: mail@rkta.de[5] IRC: #rkta[6] on Libera.Chat[7]
Copyright (c) 2017-2023 Rene Kita