Keyboa
How do I get it?
See the GitHub repo for installation instructions.
What is it?
Keyboa is a way to make your keyboard programmable. There are many macro, hotkey and UI automation frameworks out there. Here’s what sets Keyboa apart:
- Many frameworks can only send key events to applications, while others can listen to key events but still let them reach applications. Keyboa can consume all key events coming from the keyboard, allowing you to process them in any way before sending them to applications.
- Most frameworks constrain you to some particular programming language. Keyboa lets you process key events in any language you want by using pipes for communication.
- You have complete control over the interpretation and production of key events. This includes both key-down and key-up events for both regular and modifier keys.
- Keyboa attempts to follow the
Unix philosophy
to make programs that act as simple modular filters, do one thing and do it
well.
It consists of three independent, composable parts:
- listenkey reads all key events coming from the keyboard, optionally preventing them from reaching applications, and prints them on stdout.
- sendkey reads key events on stdin and sends them to applications. This tool conveniently speaks the same JSON-based language as listenkey does, but is independent so you can use any automation framework instead.
- libkeyboa is a python library for key event processing between listenkey and sendkey. It is included for convenience, not necessity.
- It aims to eventually work on both Windows and Linux. For now, Linux support is somewhat limited.
What are some use cases?
I have used Keyboa in one incarnation or another since 2010. During this time, my personal setup has accumulated a nice pile of functionality. I’ll list some of it here, as inspiration for what you can use Keyboa for. If you’re interested in the code, it’s included in Keyboa as an example called “layout1”.
- Any key can function as both modifier and character, and
most keys do.
- In particular, having Ctrl and Alt on home row is a simple thing that you just can’t live without once you try it.
- Many layout layers, including
- Navigation and window management layers.
- Symbols layer. How about lisp programming with parentheses on home row?
- A numpad that’s actually usable since you don’t have to move your hand to a separate keyboard section, yet you can access numbers (also hexadecimal), function keys and appropriate punctuation.
- Greek, Cyrillic and math characters
- Box drawing
- Bring back the legacy modifier keys Super, Hyper and Meta. This will give you many unused key combinations to use for customization. Let Emacs handle Meta and Alt as distinct modifiers, and use Alt combinations for your own customizations.
- Re-implementation of some text editor functionality so it can be used in all
applications:
- Macro recording and playback, automatically saved between sessions
- Numeric argument for repetition
- Insert character by Unicode code point
- Insert current date/time
- At one point I had an entire password manager built in. Don’t do that.