Scripts quick access edit this

Synopsis Edit

Paste or clear the primary selection using the keyboard.

Description Edit

This module contains a function keyboard-paste which simulates a middle-button mouse click in order to paste the current primary selection, and another function clear-selection to clear that primary selection.

Installation Edit

Configuration Edit

This code uses Sawfish's synthesize-event function, which in turn uses XSendEvent to pass the event to the window. These synthetic events are deliberately ignored by xterms and XEmacs, for security reasons. To work around this problem, start the terminal with

xterm -xrm 'xterm*allowSendEvents: True'

The analogous hack for XEmacs (not needed if you set *keyboard-paste-use-gnuclient*) is to use

(setq x-allow-sendevents t)

WARNING: These hacks open a fairly serious security hole, though, so only do this if you know what you are doing.

If you have gnuclient available with your XEmacs installation, this module can use that instead. Just make sure that *keyboard-paste-use-gnuclient* is set and there should be no need to allow send-events to XEmacs.

aterm honours XSendEvent as long as the mouse is over the terminal window, which means that keyboard-paste works in that situation.

In order to fix this properly, Sawfish will need to be patched to use XTestFakeKeyEvent in the XTest extension rather than XSendEvent, as suggested at GeneratingSyntheticX11Events (or possibly by other means, such as using the XInputExtension; I don't know a great deal about this area).

Community content is available under CC-BY-SA unless otherwise noted.