benjaminor / kkp

Emacs support for the Kitty Keyboard Protocol
GNU General Public License v3.0
32 stars 6 forks source link

Allow user to remap modifiers #1

Closed rdparker closed 1 year ago

rdparker commented 1 year ago

This adds support for mapping physical modifier keys, as reported by the Kitty Keyboard Protocol, to different Emacs modifiers. It is modeled after the behavior of the mac-command-modifer, mac-option-modifier and related variables.

By default all the new kpp-*-modifier variables map 1-to-1 with the named modifier. This introduces a change from prior kpp.el behavior where <Alt> and <Meta> both mapped to <Meta>. Currently the kpp-alt-modifer maps to <Alt>. This may be changed by a simple:

(setq kpp-alt-modifer 'meta)

The motivation for this PR was that in Emacs on macOS my Command (⌘) key is set to produce <Meta> and I wanted the same behavior with KPP in a terminal.

benjaminor commented 1 year ago

Hi, thanks for the thought-out PR. Looks good to me, one small comment: By default, I would set the kkp-alt-modifier to 'meta to not change the default behaviour on a standard Linux machine (at least on mine :)).

And then mention in the README that one can change kkp-alt-modifier (or any other modifier) to 'alt. What do you think?

benjaminor commented 1 year ago

Hi, I went ahead and merged the PR, but applied the changes I suggested in the last comment. Thanks for the PR again!