### Disable device Here's one idea towards identifying which keyboard is which. You can use the command [**xinput**][1] to enable and disable devices. ### Example $ xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ SynPS/2 Synaptics TouchPad id=12 [slave pointer (2)] ⎜ ↳ TPPS/2 IBM TrackPoint id=13 [slave pointer (2)] ⎜ ↳ Logitech USB Receiver id=9 [slave pointer (2)] ⎜ ↳ Logitech USB Receiver id=10 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Power Button id=6 [slave keyboard (3)] ↳ Video Bus id=7 [slave keyboard (3)] ↳ Sleep Button id=8 [slave keyboard (3)] ↳ AT Translated Set 2 keyboard id=11 [slave keyboard (3)] ↳ ThinkPad Extra Buttons id=14 [slave keyboard (3)] The above output shows the various devices that I have on my Thinkpad laptop. I only have 1 keyboard attached, this one: ↳ AT Translated Set 2 keyboard id=11 [slave keyboard (3)] Now take a look at the properties available through this device: $ xinput list-props "AT Translated Set 2 keyboard" Device 'AT Translated Set 2 keyboard': Device Enabled (124): 1 Coordinate Transformation Matrix (126): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0. From the above you can see that it's enabled, so let's disable it: $ xinput set-prop "AT Translated Set 2 keyboard" "Device Enabled" 0 To enable it: $ xinput set-prop "AT Translated Set 2 keyboard" "Device Enabled" 1 ### The idea? You could enable disable one of the keyboards using this command to determine which one you're on. ### References - [second keyboard to run commands][2] [1]: http://www.x.org/current/doc/man/man1/xinput.1.html [2]: http://unix.stackexchange.com/questions/35649/second-keyboard-to-run-commands/35835#35835