Purpose

commandN is a simple tool designed to recreate the OS X functionality of pressing command-N in X Windows. I created it for use with bbkeys, but it should work with any key-grabber that will execute arbitrary programs. No, this wasn't a really pressing problem, but I'm not qualified to cure cancer and it was pretty easy. I spend most of my time (day-to-day) working on OS X and Linux with some x2vnc action, and its really nice to have the transition between the two systems be as seamless as possible.

Details

To be perfectly clear, commandN spawns a new window of the active application. Because the functionality isn't present by default in all X Windows applications, getting it to work is a bit of a hack and depends on a couple things. The process basically attempts the following:

  1. determine which window has focus
  2. execute the command property from the active window
  3. if that doesn't exist use the class name
  4. ...perhaps in lowercase
  5. or look-up the PID property from the window
  6. and perhaps get the process group leader

If commandN fails to execute anything it will print the class name of the front most window. In cases where the execution does not work, you can always link to the executable (or build a script) using the class name.

The code (and perfunctory Makefile) is available in the repository.

Disclaimer

commandN comes with no warranty, and you are granted only the non-exclusive right to compile and execute. At some point soon I'll figure out what license to use and make the code available under as FOSS.

Contact

You may contact me with bugs and patches by sending email to commandN at this domain.