Is it possible to use different keyboards for different applications?

What I would like is this:

I would have two keyboards. One of them is "connected" to Matlab, the other is "connected" to my text editor of choice. This way, I could edit some script and still test some commands in Matlab without having to constantly switch between the applications.

Basically, I would want to have an additional keyboard attached to my computer that solely controlled Matlab. That would be awesome!

Is there any way to do this? Preferably with OSX, but it would be fun on Windows or Linux, too.


If you are a system programmer, then it should be easy for you to get this functionality. Steps using AutoHotKey script for Windows:

  1. Make an AutoHotKey script that can detect keystrokes on different keyboard,
  2. Then using windows handle, get the winID for both programs
  3. Map different keyboards to different WinIDs

I had done the similar function for controlling my music player even my active window was VS-2010/MatLab/ or any other window.


I don't know if you can do this natively. I've never seen this, but I'd love to have this functionality.

One hackish solution is to use something like VMWare and to run Matlab in the virtual machine and "connect" the second keyboard to the virtual machine. It's less than elegant, but should work.


If you have multiple monitors, you can run different X servers for each monitor in linux and manually specify the keyboard/mouse devices which each server uses. This allows you to log on twice, load matlab in one screen and your editor on the other, and have separate mouse/keyboards for each.