Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

key-remap configuration to remap modifiers at the app-level #5160

Open
mitchellh opened this issue Jan 16, 2025 · 1 comment
Open

key-remap configuration to remap modifiers at the app-level #5160

mitchellh opened this issue Jan 16, 2025 · 1 comment
Labels

Comments

@mitchellh
Copy link
Contributor

mitchellh commented Jan 16, 2025

Discussion: #3493 (comment)

Introduce a new configuration key-remap which can be used to remap keys from one to another within the scope of Ghostty. Example:

key-remap = ctrl=super
key-remap = left_control=right_alt

This would act the same as if a user went to their OS config and remapped these keys. If a sided-modifier isn't specified, then left swaps with left, right swaps with right.

Notes:

  • This is a one way remap. In the example above, ctrl becomes super but super does not become ctrl.
  • Remaps are not transitive. If you remap ctrl=super and then alt=ctrl, then alt != super. Alt would be mapped to control.
  • This doesn't interact with keybind in any way. In the same way keybind is already roughly unaware of keyboard layouts (i.e. cmd+f works with f as specified by your layout), the same will happen in this case (i.e. cmd+f will trigger with a physical "ctrl" key if you remapped cmd=ctrl).

Additional scope limiting

For the initial creation of this feature, we should limit scope in the following ways:

  1. Only remap modifier keys
  2. Only work on macOS

There is a much more urgent need and request for this on macOS (see #3493) and macOS APIs give us a much easier way to do this by easily letting us insert event filters in the path. My attempts at doing this with GTK have thus far failed, but I think it's possible.

In the future, we can likely lift both of these limitations.

@mitchellh
Copy link
Contributor Author

mitchellh commented Jan 16, 2025

Just repeating myself: this is only tagged macOS because I'm happy to close this one macOS supports this. This has been heavily requested by macOS users and the discussion explains many reasons why. I don't recall seeing any requests for this at all for Linux users but if there are it's been relatively few.

The design of the config does not preclude Linux support in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant