I'm trying to make my keyboard function a bit like a stenotype (but not). I want to bind combinations of keys to commands and ignore the standard individual key presses.

I am on GNU/Linux, using Xorg. I don't mind if the solution relies on Xorg.

Utilities like sxhkd and xbindkeys can bind key combinations to commands, capturing those events but I don't know how I could make them suppress everything beside the specified key combinations.

Does anyone know how I could do this? Could you point me in the right direction in Linux generally, a utility, or something in a programming language? I know shell scripting, Python, and I am just beginning to learn C. This keyboard module for Python looked good but there's currently no key suppression for Linux .

  • 1
    Hmm, it's likely possible with an ugly combination of xmodmap and sxhkd/xbindkeys. Xmodmap can truly rebind the keys, so you can rebind them to some bogus key that doesn't do anything (like XF86Send or something) and then use sxhkd/xbindkeys to run something when that key is pressed but it's gonna be convoluted and probably tricky to get it working right. – Cestarian Jan 19 at 13:42
  • You should really look into hooking into some input method framework like XIM, IBus, SCIM, uim, etc though it's NOT for the faint of heart ;-) Of course, you can simply write your own xbindkeys-like X11 app which grabs the "prefix" keys passively (and then grab the whole keyboard, etc), but you will run into issues with dummy apps -- which unfortunately includes things like chromium ;-( -- reacting to Notify{Grab,Ungrab} focus events as if the user had entered/leaved the window. And you will end up hating blindly typing key sequences, anyway ;-) – mosvy Jan 21 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.