That's great. As a matter of fact, nosskey has it I've implemented it as a prototype. You may be able to use it as a reference. https://github.com/ocknamo/nosskey