[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: xterm - selecting URL

On Thu, Nov 20, 2003 at 03:24:07AM +0000, Antony Gelberg wrote:
> Hi all,
> I miss one thing from gnome.  gnome-terminal let me ctrl-click on a url,
> and open mozilla.  Any other xterm replacements that can do this?

> But I don't want to install all the gnome-terminal dependencies if I can
> use something else...

I'm not aware of any other terminal that "sees" urls and lets you simply
click on them other than ... er.. I *thought* konsole, but I'm checking
it out right now and it doesn't seem to do it.  So I know of no others.
:)  But what you *can* do, is map a keybinding to load the currently
selected url.  Install 'xsel', a small command line utility that lets
you interact with the clipboard, and you could map a keybinding to do
something (I believe) like this:

mozilla -remote `xsel`

As far as creating that keybinding.. it depends on your window manager /
desktop environment.

> I also liked the "intelligent" text selection mechanism, where if you
> didn't select a url from the start, it would often get it right.

You can do this in xterm with the "charClass" X resource, to control
what gets selected when you double-click.  That way, you just double
click anywhere in a URL, and it selects the whole thing.  In
~/.Xdefaults or ~/.Xresources, put something like this:

XTerm.charClass: 33:48,35:48,37:48,43:48,45-47:48,58:48,64:48,95:48,126:48

That's what I had when I stopped using xterm; it still misses a few
characters if I remember correctly.  Basically it's just a bunch of
comma seperated numerical ascii codes that correspond to characters, and
each has a :48 after it (don't quite remember what the :48 is all
about).  Each character it matches is included in the list of characters
that a double-click selection should "span."  The above list matches the
following characters:

! # % + - . / : @ _ ~

Which obviously are all pretty common in urls, that's why they're in
that list.  As I mentioned, I quit adding things to it, so there are
probably a few characters left you'll want to add to get double clicking

An easy way to get the ascii code for a character would be with Python:

% python -c 'print ord("a")'

Where "a" is the letter you want.

And also, your .Xdefaults or .Xresources file should be loaded at X
startup automatically, but you can run 'xrdb -merge <file>' on whichever
to reload it on the fly.

Nick Welch aka mackstann | mack @ incise.org | http://incise.org
Give me enough medals, and I'll win any war.
		-- Napoleon

Reply to: