I would like to get a second keyboard for just frequently used unicode characters and keyboard shortcuts. Ie, I would like to bind the "a" key on my second keyboard to opening firefox, for example. Another example would be binding the "b" key to inserting the ✓ character, so I don't have to type the ctrl+shift+u, 2713 each time.

OS is Ubuntu, wm is fluxbox. Thanks!


First find event handler of your second keyboard. Run

$ cat /proc/bus/input/devices

Find your second keyboard device in the output and note number of event handler. For example:

I: Bus=0011 Vendor=0001 Product=0001 Version=ab41
N: Name="AT Translated Set 2 keyboard"
P: Phys=isa0060/serio0/input0
S: Sysfs=/devices/platform/i8042/serio0/input/input2
U: Uniq=
H: Handlers=sysrq kbd event2 
B: EV=120013
B: KEY=6007 2900000 83802078 f040d001 feffffdf ffefffff ffffffff fffffffe
B: MSC=10
B: LED=7

"H: Handlers=sysrq kbd event2" tells us that device we want to monitor is /dev/input/event2. Now we need to capture pressed keys. A useful tool is actkbd - http://users.softlab.ece.ntua.gr/~thkala/projects/actkbd/ After downloading it and installing you can get keyboard codes with:

$ sudo actkbd -s -d /dev/input/event2

Pass event device you got before to -d option. Tap keys you want to use, note their numbers and turn off actkbd with Crtl+C shortcut.

To bind commands to shorcturs put into actkbd configuration file, /etc/actkbd.conf, lines with following format: key-numbers:::command and run actkbd daemon again same way as before. For example to run gedit after tapping a key put this line:


Inserting Unicode characters is more tricky. I don't know if there is a way to insert those directly but I can propose a simple workaround. You can use xclip or xsel command to put any string into clipboard, and then paste it into any application you want using middle mouse button. Example configuration line using q button key:

16:::echo -n '✓' | xsel
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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