|Scripts quick access edit this|
- Author: Ewan Mellor <firstname.lastname@example.org>
- Version: 1.2
- License: MIT License
- Download: keyboard-paste.jl
- Homepage: http://www.ewanmellor.org.uk/sawfish.html
Paste or clear the primary selection using the keyboard.
This module contains a function
keyboard-paste which simulates a
middle-button mouse click in order to paste the current primary selection, and
clear-selection to clear that primary selection.
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
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).