second keyboard to run commands
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
[cut]
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: PROP=0
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: PROP=0
B: EV=1b
B: KEY=2010000 397ad801d001 1e000000000000 0
B: ABS=100000000
B: MSC=10
[cut]
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
[cut]
↳ 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.