Change X Windows select to copy
Cameron Simpson
cs at zip.com.au
Fri Feb 25 04:26:46 UTC 2011
On 24Feb2011 15:04, Yong Huang <yong321 at yahoo.com> wrote:
| I'd like to change the behavior of X Windows from copying when you
| select (highlight), ideally to copying when you press Control-C and
| pasting when you press Control-V. The man page for xterm has these lines
| as example:
|
| *VT100*translations: #override \n\
| ~Shift~Ctrl<Btn2Up>: insert-selection(PRIMARY, CUT_BUFFER0) \n\
| Shift~Ctrl<Btn2Up>: insert-selection(CLIPBOARD, CUT_BUFFER1) \n\
| ~Shift<BtnUp>: select-end(PRIMARY, CUT_BUFFER0) \n\
| Shift<BtnUp>: select-end(CLIPBOARD, CUT_BUFFER1)
|
| which I added to ~/.Xdefaults. With that, I can't figure out how to
| copy. If I got that to work, I think I could change the left column to
| Ctrl-C... Any suggestion? Is that the right way to go?
Firstly, I would choose other key bindings. ^C is used to send SIGINT
(interrupt) in most termoinal environments and ^V is used for
"literal-next", to say "do not treat the next keystroke specially. For
example, since ^C sends interrupt, if you wanted to embed a literal ^C
in a command you would type ^V^C, and the ^C would then not send
interrupt but be passed to the running program as byte 3.
So I would recommend binding to Alt-C and Alt-V (or Meta).
So maybe (untested):
~Shift Alt <KeyPress> XK_C: copy-selection(CLIPBOARD, CUT_BUFFER1)
Notice that PRIMARY and CUT_BUFFER0 are used for the "old"/"normal" x11
cut/paste scheme where selection and copy are synonymous, and that
CLIPBOARD and CUT_BUFFER1 are used for "pc/mac style" where selection
and coipy are distinct activities. The two schemes can and do co-exist.
Confusing perhaps, but it offers choice to the user.
FInally, on many terminals Shift-Insert is bound to paste already, which
may save you bothering to binding Alt-V.
--
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/
Heavier-than-air flying machines are impossible.
--Lord Kelvin, president, Royal Society, 1895.
More information about the redhat-list
mailing list