Archive for June, 2005

Xterm and the clipboard

Thursday, June 16th, 2005

It has long been an annoyance that xterm doesn’t follow the same rules with regard to the clipboard as most GTK/Gnome applications.

Xterm by default only uses the PRIMARY selection for copy and paste, and follows the implicit selection model where the selection is set immediately when text is selected with the mouse, without any further action from the user.

Most GTK/Gnome applications uses both an implicit selection model with the PRIMARY selection, and an explicit selection model with the CLIPBOARD selection.

I don’t know of any way to get xterm to behave like most other applications, but this little set of X ressources will enable the use of the CLIPBOARD selection in xterm, when the Shift key is down.

XTerm*VT100.Translations:    #override
	Shift<Btn1Down>:		select-start()

	Shift<Btn1Motion>:		select-extend()

	Shift<Btn1Up>:			select-end(CLIPBOARD)

	Shift<Btn2Up>:			insert-selection(CLIPBOARD)

	Shift<Btn3Down>:		start-extend()

	Shift<Btn3Motion>:		select-extend()

	Shift<BtnUp>:			select-end(CLIPBOARD)

With GNU Emacs you can always learn

Sunday, June 5th, 2005

It is close to twenty years that I have been using GNU Emacs almost daily, and you still figure out new stuff.

I’ve been somewhat annoyed that copying and pasting between Emacs and Gnome applications were so inconsistent, and then its all in the manual:

Using the Clipboard

As well as the primary and secondary selection types, X supports a “clipboard” selection type which is used by some applications, particularly under OpenWindows and Gnome.

The command `M-x menu-bar-enable-clipboard’ makes the `Cut’, `Paste’ and `Copy’ menu items, as well as the keys of the same names, all use the clipboard.

You can customize the option `x-select-enable-clipboard’ to make the Emacs yank functions consult the clipboard before the primary selection, and to make the kill functions to store in the clipboard as well as the primary selection. Otherwise they do not access the clipboard at all. Using the clipboard is the default on MS-Windows, unlike most systems.

Maybe its time to read it again.

irctail – track a file on an irc channel

Sunday, June 5th, 2005

Irctail is a small program I wrote to keep track of log files on various servers through an IRC channel.

It will track stdin or a given file (like tail -f), and send the lines to an IRC channel.

There are options to specify irc server, channel, nick and some more. An example:

irctail -c channel -n nick irc.example.com /var/log/messages

It is possible to specify a regular expression where a prefix match on the input line will be removed before the line is sent to the irc channel. It can be used to remove timestamps and other stuff that might clutter an irc channel too much.

A more real life example.

I’m managing a fairly large network with private users, and sometimes somebody installs a wifi network so the dhcp server is exposed on the entire network. This will cause other users problems as they get dhcp responses from the wrong dhcp server.

To monitor the situation I run these commands on a network management server:

tcpdump -lten -i eth5 udp and src port 67 and dst port 68 and not net 10 >dhcp-servers.out &
irctail -c staff -n dhcp irc.example.com dhcp-servers.out &

I could just have piped the output of tcpdump and left out the output file but I’d like to keep it for later reference.

Download the irctail source code

Full manual below the fold. (more…)

Logitech Cordless Click! Plus mouse

Saturday, June 4th, 2005

Logitech Cordless Click! Plus mouse

My “Logitech Cordless Desktop LX700” set came with a “Logitech Cordless Click! Plus” mouse. Its a fancy wireless thing with loads of buttons.

It has the normal left, middle (pressing the wheel) and right buttons.

The wheel acts as buttons 4 and 5 and the two buttons on the thumb side are buttons 6 and 7.

The mouse wheel can also be tiltet left and right by making a sideways motion on the wheel without pressing it down, and there is a separate botton on the top of the mouse, but these buttons don’t appear to send anything to X. Testing with xev gives absolutely nothing.

XFree86 configuration fragments are below the fold. (more…)

Logitech Cordless Desktop LX700

Saturday, June 4th, 2005

LX700

I was getting tired of my old keyboard and decided to buy a new on. The choice fell on a “Logitech Cordless Desktop LX700”, with a “Logitech Cordless Click! Plus” mouse included.

The keyboard has a gazillion extra keys, including a roller on the left side, doubling for the arrow keys on the right, and some mouse buttons on the keyboard. It also has a bunch of keys for controlling a media player, and for other applications.

Basic functionality is there and the keyboard works out of the box with Linux. The problem lies with all the extra keys.

Some of the extra keys are known to the Linux keyboard driver and to to XFree86, and they can be configured in Gnome or your window manager without any problems. In my case this happened for several of the media player keys and the Email key. All I had to do was select “Logitech Desktop Pro” as the keyboard type in the Gnome preferences.

Many of the extra keys did not work, however.

It took quite an effort to get everything to work, but in the end each and every key on the keyboard is usable under Linux.
(more…)

SWSUSP2 working

Saturday, June 4th, 2005

I previously reported that Software Suspend 2 didn’t work for me. I have since installed a kernel 2.6.9 from TuxMobil.org, which has solved the problem. I’m now suspending and resuming happily.

Labels on ext2 and ext3 filesystems

Thursday, June 2nd, 2005

I just recently discovered that you can put a label on an ext2 or an ext3 filesystem, just like you can with a msdos/fat filesystem.

The reason I didn’t know was probably that it didn’t matter, but now with hal and gnome-volume-manager automounting removable disks, the disks in my usb enclosures are mounted as /media/usbdisk, that is, until I changed the label. Then it is mounted as /media/label, which is a lot more useful.

The label is set with:

e2label /dev/sdc1 yourlabel

Replace the partition with the one you want to set the label on.