summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2023-12-30 08:53:14 +0400
committerKirill Chibisov <contact@kchibisov.com>2023-12-30 09:42:02 +0400
commit85d85e49b2a9c3979b2bd12a78cfe0af4ca10b30 (patch)
tree0213e5b7ac9adfeecd379330684e4b3c4c81072e
parent6223cabe17945a86ff4adeb3dfb84c90186f4ea3 (diff)
downloadalacritty-85d85e49b2a9c3979b2bd12a78cfe0af4ca10b30.tar.gz
alacritty-85d85e49b2a9c3979b2bd12a78cfe0af4ca10b30.zip
Fix inability to bind `Alt+Control` on Windows
Fixes #7506.
-rw-r--r--CHANGELOG.md1
-rw-r--r--alacritty/src/input/keyboard.rs9
2 files changed, 9 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 77924ef8..34e764b9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- `alacritty migrate` failing with nonexistent imports
- `Alt` bindings requiring composed key rather than pre-composed one on macOS
+- `Alt + Control` bindings not working on Windows
## 0.13.0
diff --git a/alacritty/src/input/keyboard.rs b/alacritty/src/input/keyboard.rs
index 6d2abea1..8e559be1 100644
--- a/alacritty/src/input/keyboard.rs
+++ b/alacritty/src/input/keyboard.rs
@@ -174,7 +174,14 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> {
let logical_key = if let Key::Character(ch) = key.logical_key.as_ref() {
// Match `Alt` bindings without `Alt` being applied, otherwise they use the
// composed chars, which are not intuitive to bind.
- if cfg!(target_os = "macos") && mods.alt_key() {
+ //
+ // On Windows, the `Ctrl + Alt` mangles `logical_key` to unidentified values, thus
+ // preventing them from being used in bindings
+ //
+ // For more see https://github.com/rust-windowing/winit/issues/2945.
+ if (cfg!(target_os = "macos") || (cfg!(windows) && mods.control_key()))
+ && mods.alt_key()
+ {
key.key_without_modifiers()
} else {
Key::Character(ch.to_lowercase().into())