3

I am using Linux Mint and would like to experiment with turning my keyboard into a chorded keyboard. One way I can think of to do this is to write a daemon to intercept and replace keyboard events.

I also considered the possibility of writing my own device driver but I suspect that would be very difficult (it would be a good skill to have though). I have also come across the term keyboard hooks, I am not sure what that is but it could be what I need.

What is a good way to accomplish this goal and how do I do it? If, for instance, writing a daemon is the best way to go about it then how do I intercept and replace keyboard events? Or if I can do it through, say, global macros/key combinations then how do I create them and disable the key's normal operation?

2 Answers 2

1

Writing a daemon to intercept and replace key events is the best solution I have found. I think there are ways to do this through X (the xcape project does not do chording but its source code might be a good reference for capturing and modifying input at the X level), but, if you want something that works on Wayland (and also a plain terminal), the best option I have found is working with libevdev which is lower level than X. The nice thing about evdev is that it is pretty universal across Linux systems whereas higher levels in Wayland vary across desktops (GNOME, KDE Plasma, Sway) and do not have plugin systems for modifying input.

There are several projects around that support modifying inputs with libevdev. Here are a few:

These came from the xcape issue about Wayland support. They don't all support chording directly but they demonstrate how to work with libevdev. There are also language bindings for libevdev (a quick search turns up bindings for Python, Ruby, Rust, Go, NodeJS, etc.) if you want to write something from scratch.

Specifically related to chording, you can look at the Chorded Keymap plugin for Interception Tools (disclaimer: I wrote it). It is rough but demonstrates some chording functionality.

See also these related questions:

0

One approach: You could try to use autokey http://code.google.com/p/autokey/ or IronAHK https://github.com/polyethene/IronAHK to create hotkeys, override the normal key's functionality, and update a data structure containing the set of currently pressed keys. Then you could monitor the data structure, and fire events if a key combo is pressed for a minimum amount of time.

1
  • AutoKey looked like it would work at first but this topic states that it isn't possible to chord with anything other than modifier keys. groups.google.com/forum/?fromgroups=#!topicsearchin/… AutoKey has been stated to be more powerful than IronAHK so I expect that is not capable of chording either. (I am currently searching their forum to make sure however.) Commented Dec 20, 2012 at 18:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .