Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've seen some setxkbmap stuff when talking about key mappings, but ctrl-c isn't a single key.

Ideally, I would love to make it a copy/paste key but that seems impossible on Linux.

Is there a way on Gentoo/Arch Linux to remap the caps lock key into:

  • caps lock on = copy
  • caps lock off = paste

or just a "hitting the caps lock = ctrl+c" mapping?

share|improve this question

There isn't a way to produce a keypress event based on the state of a locked key like that. There are a few reasons for that, but as a counter example, what happens if you copy something, then later want to copy something else without pasting? You select something in your editor, press Caps Lock, and rather than copying, which is your intent, it pastes the previously copied buffer, deleting your selected text. Hope you can undo!

I believe there's also no way in XKB to have a single keypress produce Ctrl-C, but there are a few tools to do just that.

Generally speaking, XKB works really well and is very versatile, but if you want something more custom than what it provides, it tends to make your life difficult. Or at least it used to, last time I tried.

share|improve this answer
One way to emulate the detection of states would be to keep the last state stored somewhere. – Chris Down May 28 '12 at 11:39
Which tools would you suggest to accomplish that? – sublimepua May 28 '12 at 19:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.