sedwards2009 / extraterm

The swiss army chainsaw of terminal emulators
https://extraterm.org
MIT License
2.53k stars 116 forks source link

Remap modifier keys #429

Open darinpp opened 1 year ago

darinpp commented 1 year ago

I switch often between mac os and linux. Sometimes connect to a linux desktop from mac. To make keys behave the same between the two - I swap Ctrl and Meta(Alt) for all apps on the linux desktop. That works perfectly for everything except terminal. A terminal needs to have these reversed to match mac. With extraterm I do that by removing the if around this code in QKeyEventUtilities.ts

  if ((<Platform> process.platform) === "darwin") {
    // Qt on macOS reverses the meaning of these keys compared to what they are commonly called.
    const tmp = ctrlKey;
    ctrlKey = metaKey;
    metaKey = tmp;
  }

What is the proper way to make this configurable? On mac in iTerm there is a set of very convenient settings that allow remapping the modifier keys like this image

Not sure if that makes sense for extraterm but perhaps just an ability to swap meta and ctrl would be nice. Is the prefered way to do this to add an extra mapping config to the keybindings json files and to use it in QKeyEventUtilities.ts?