Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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

On my computer I have two USB keyboards plugged in. Instead of having both just type the same key, is it possible for a second keyboard to be setup to run commands instead of typing letters? And If that's not possible, can it be setup to at least type in another language like Russian for example?

share|improve this question
Do you want to bind specific commands to chosen keys of second keyboard to be able only run something and not type letters? – pbm Apr 4 '12 at 19:08
And next question: do you want to use shortcuts for running background applications (or application in X environment) or just type name of the command in active terminal using keyboard shortcut? – pbm Apr 4 '12 at 19:26
Alternative way to disable sending keys to applications. askubuntu.com/a/178741/554601 – Ariunbayar Jun 8 at 7:57
up vote 8 down vote accepted

This is my third answer when I can recommend actkbd... :)

So if you want to configure all keys of second keyboard to run commands not to type letters you can use actkbd... :)

After installing actkbd we need to find what device file is used to receive events from out keyboard:

pbm@tauri ~ $ cat /proc/bus/input/devices 
I: Bus=0003 Vendor=046d Product=c31c Version=0110
N: Name="Logitech USB Keyboard"
P: Phys=usb-0000:00:1a.0-1.1/input0
S: Sysfs=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/input/input7
U: Uniq=
H: Handlers=sysrq kbd event5 
B: EV=120013
B: KEY=1000000000007 ff9f207ac14057ff febeffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=1f

I: Bus=0003 Vendor=046d Product=c31c Version=0110
N: Name="Logitech USB Keyboard"
P: Phys=usb-0000:00:1a.0-1.1/input1
S: Sysfs=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.1/input/input8
U: Uniq=
H: Handlers=kbd event6 
B: EV=1b
B: KEY=2010000 397ad801d001 1e000000000000 0
B: ABS=100000000
B: MSC=10

On this list you should find your keyboard, and check it handlers. Use sudo actkbd -s -d /dev/input/HANDLER_NAME to check if that handler send events. If you run this command and press key on keyboard (check for keys that you want to bind to commands) you should get something like that:

pbm@tauri ~ $ sudo actkbd -s -d /dev/input/event5 
Keys: 57
Keys: 35

If you have keycodes we could create actkbd config file:

pbm@tauri ~ $ sudo nano /etc/actkbd.conf 
30:::sudo -u pbm DISPLAY=:0 amarok
//30 is keycode for letter a

When you save that file we should test if configuration works:

pbm@tauri ~ $ sudo actkbd -d /dev/input/event5 -D

When you press key that you have in your config file command from last column of config file will be started.

I think that there is a way to disable sending keys to applications, but I was unable to find it - check out README file.

Instead of trying to disable it using actkbd you could turn off your keyboard in X.

pbm@tauri ~ $ xinput list
    ↳ Logitech USB Keyboard                     id=12   [slave  keyboard (3)]
    ↳ Logitech USB Keyboard                     id=11   [slave  keyboard (3)]
pbm@tauri ~ $ xinput set-prop 11 "Device Enabled" 0
pbm@tauri ~ $ xinput set-prop 12 "Device Enabled" 0

It should do the work... :) For more information about actkbd check out this answer.

Using actkbd (and few scripts probably) you can also configure your keyboard to change modes from command mode to input mode with Russian letters. For this read Ulrich Schwarz's answer.

share|improve this answer
I have asked this question a million times on a billion forums and you're the only one that actually new this. Thanks a trillion. – captainandcoke Apr 24 '12 at 2:12

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.