Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I start my browser vimprobable in tabbed like so:

"`tabbed -d > /tmp/tabbed.xid`; vimprobable2 -e `cat /tmp/tabbed.xid`" [1]

I am then able to send all new instances of vimprobable to tabbed (and not have a new master window open), in other apps, eg., mutt, by:

vimprobable2 -e $(cat /tmp/tabbed.xid) %s

I would like to achieve the same thing in Urxvt.

Currently my .Xdefaults contains the matcher arguments:

URxvt.perl-ext-common: default,matcher
URxvt.urlLauncher: vimprobable2
URxvt.matcher.button: 1

I have changed the launcher line to point at a wrapper script:

URxvt.urlLauncher: vimprobtab.sh

Which is just:

vimprobable2 -e $(cat /tmp/tabbed.xid) %s &

but this just opens a browser instance in tabbed with the default search engine result for & (or %s if I remove the ampersand).

I have tried with other obvious variables, like "$1" and "$@" - they don't work either.

How do I pass the URL to the wrapper script?

[1] This also feels like a useless use of cat, so alternative suggestions would be welcome

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The help text for the matcher PERL extension to urxvt states:

When clicked with the mouse button specified in the matcher.button resource (default 2, or middle), the program specified in the matcher.launcher resource (default, the urlLauncher resource, sensible-browser) will be started with the matched text as first argument.

therefore, you need to set URxvt.matcher.launcher to a script that takes a single argument (in sh-type shells, this is spelt $1) and open it. For example:

#! /bin/sh

exec vimprobable2 -e $(cat /tmp/tabbed.xid) "$1"

Note: It's advisable to quote the $1 argument to prevent the shell from interpreting meta-characters that may appear in the URL (e.g., & or ;).

share|improve this answer
    
Thanks Riccardo, that works nicely. –  jasonwryan Jun 24 '11 at 19:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.