bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#22163: Feature request: Add support for key release event


From: Simon Friis Vindum
Subject: bug#22163: Feature request: Add support for key release event
Date: Sun, 13 Dec 2015 09:58:07 +0100

Dear Emacs developers

I apologize if this feature has been requested before. I was not able to find any such requests.

The feature request:
It should be possible to bind functions to the _release_ of a key.
Additionally it would also be nice if it was possible to get the current state of a key. I.e. is it pressed or not.

As far is I understand implementing this in the terminal is impossible—so this feature would be for graphical environments only.

Motivation:
Here are a few ideas that I've wanted to implement as Emacs extensions. They all turned out to be impossible due to the lack of this feature. To implement them it would be necessary to be notified both when a key is pressed and when a keys is released.

1/ The possibility of bindings commands to the long press of a key. For instance I would bind a long press of `s` to `isearch-forward` and a long press of `n` to `avy-goto-line-below`. The extension would calculate this time difference between key press and release. And based on that decide between short- and long-press behaviour.

2/ An extension that would make it possible to use a regular key as a modifier key. For instance holding `j` with the right hand could activate "wasd" directional keys for the left hand. Or holding `a` could activate vim-like directional keys with "hjkl". The possibilities are many.

3/ Get press and hold behaviour independent of the OSs key repeat behaviour. If I bind a function (e.g. one that scrolls the buffer a single line) to a key binding then the behaviour will be like this: initial press scrolls one line. Then there is a long delay. After that a single line is scrolled with very short delays. It is controlled entirely by how key repeat works in the OS. Getting rid of the initial long delay or controlling the repeat interval is impossible.

In my initial search for this feature I came across a bunch of StackOverflow questions that also asked for behaviour that would require this functionality. Often the best answer was to use key-chords. But the semantics of pressing two keys quickly after each other is quite different from the press-and-hold semantics of a modifier.

Thank you for considering this.

Kind regards
Simon Friis Vindum

reply via email to

[Prev in Thread] Current Thread [Next in Thread]