Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like one of my keyboards to send normal keys, and the other to run macros when I press a key on that. Is this possible?

share|improve this question
    
By "macro", do you mean a bash script? –  Peter.O Apr 4 '12 at 5:42

1 Answer 1

up vote 2 down vote accepted

Do you really need two keyboards? If you always have your Num-Lock key either on or off, you can do what you want with just a single keyboard... This method may(?) work with two keyboards if you prefer. Using a single keyboard may be faster than having to move you hand(s) from one keyboard to the other.

You can use xbindkeys which allows you to launch shell commands with your keyboard or mouse under the X Window System. The particular feature of xbindkeys which can be used here is that it responds to the state of the Num-Lock key.

Lets assume that in your normal typing mode you have Num-Lock on... When you turn Num-Lock off, every key is seen differently by xbindkeys. So, you can assign macros to any individual key you like, eg. I use

  • Numlock / to put [2012-04-04] into the clipboard

To do this, using a single keyboard, I need to press three keys
For two keyboards, it would only need that you press the Numlock / key.

  • Numlock    -- to turn Numlock off
  • Numlock / -- to run my script (macro)
  • Numlock    -- to turn Numlock on

Aside from the Numeric-keypad keys, the other keys function normally whether Numlock is on or off. So if you don't typically use the keypad at all, then it may be enough to use xbindkeys and assign 16 shortcut keys for Numlock off, and another 16 for Numlock on. Otherwise you have all keys available as new shortcuts..

(for Ubuntu): sudo apt-get install xbindkeys xbindkeys-config

share|improve this answer

Your Answer

 
discard

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.