0

I would like to setup keyboard shortcuts with other keys that traditional modifier keys, as modifier keys.

example : bind "f1-left" ( so F1+) to a command.

But not bind the sequence F1 to the command like explained in this answer : Using function keys as "sticky" modifier keys

is that something possible in emacs ?

I see commands such as

(define-key function-key-map [f8] 'event-apply-super-modifier) but is there a command binding on press and on release events ? like a "define-key-press" "define-key-release" ? If so we could bind a command event-apply-super-modifier when f1 is pressed and event-release-super-modifier when f1 is released.

1 Answer 1

1

You currently cannot do that within Emacs (at least, not without changing Emacs's C code).
We could expose the "press" and "release" events on keyboard keys, but we don't do that so far.

OTOH, you can do it outside of Emacs with xmodmap (or its more modern replacement, IIRC it'd be something like setxkbmap).

E.g. something like:

xmodmap -e 'add mod4 F1' 

after which you can do

(global-set-key [H-left] 'my-favorite-command-for-f1-left) 
1
  • You might want to mention that xmodmap and setxkbmap might not be available on all platforms. Commented Sep 20, 2019 at 15:36

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.