Clickable PDFs in rxvt

evincepdfrxvt

I would like to open PDFs (say, with evince) by clicking in the terminal.

The setup is urxvt in Fedora 19 here, but if urxvt cannot do this, can you let me know which terminal emulators can. I got URL detection working by putting:

urxvt*perl-lib: /usr/libi64/urxvt/perl/
urxvt*perl-ext-common: default,matcher
urxvt*matcher.button: 1
urxvt*url-launcher: /usr/bin/xdg-open

Into my ~/.Xdefaults and running xrdb -load ~/.Xdefaults, so hopefully there is some similar solution for the problem at hand.

Best Answer

I think I found the answer. One has to look at

/usr/lib64/urxvt/perl/matcher

and there they give examples. My usecase is to do

find . | grep -i something

and get a bunch of lines like

./foo/bar/something1.pdf
./bar/foo/something-and-else.pdf

so that adding the two lines

urxvt*matcher.pattern.1:  \\B(./\\S+?).pdf
urxvt*matcher.launcher.1: evince $1.pdf

seems to do the job. I am quite clueless about perl regular expressions, so this is not ideal. E.g.,

./foo/bar/something.pdf.trashinfo

will be caught (it shouldn't - it is not a PDF file!), whereas

./foo/barname barsurname - something.pdf

will not be caught due to the whitespaces. Perhaps somebody can write something more elegant.

Thanks to everyone who took interest in this, cheers!

Related Question