Apart from urxvt and Emacs, the program I spend most time with is
Firefox. Thus, it’s natural I want to control it from these other
programs too. Opening links is simple by just executing
to get access to its internal state, I’ve found the following two
tools very helpful:
lstab lists all tabs
that are currently open with their URL and title:
% lstab https://mail.google.com/mail/u/0/?ui=2&shva=1 # Gmail http://www.techism.de/ # Techism - Events, Projekte, User Groups in München! http://www.ilxor.com/ILX/ # ilXor.com ...
I use this tool to “synchronize” the tabs between my notebook and my
desktop. E.g. if I was surfing on my desktop (which is always on),
but need to switch to my notebook, I just run
ssh hecate lstab and
click on the few links I wanted to read.
On the other hand, if I surf on my notebook and want to go home, I just copy the open tabs to the desktop machine:
lstab |ssh hecate stee mess/current/tabs
(This simple—but very helpful to me—command line inspired this series
of posts, by the way.)
stee will be explained later, essentially it
writes stdin to the argument file name. The purpose of
explained here already.
The companion tool is
curtab, which simply
outputs the URL of the last selected tab:
% curtab http://www.imdb.com/title/tt0052561/
I use this most often when preparing
Trivium, where a simple
insert-curtab pastes the current URL into my Emacs buffer.
How do these scripts work? They parse Firefox’s
which keeps all this data formatted as JSON.
If I ever wanted to replace my browser, I’d certainly need to figure
out how to rewrite these scripts first.
NP: Aimee Mann—How I Am Different