From 1725e30e144b04e2e2e30efc76eb968c97a0eabf Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Sun, 3 Oct 2021 14:27:30 -0600 Subject: Relax the ASCII constraint for ALT, and add support for LOGO. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Traditionally only ASCII characters can be sent with the ALT key. This is an arbitrary restriction than I have relaxed. This means now ALT+ñ will produce '^[ñ' on the terminal as expected. I have also added support for the Windows key to send the escapesequence '\x1b@\x1b\' so a mapping can be created in Vim for something like 't' for Windows+t. In addition, it's worth noting that Glutin does not differentiate between the windows key and the hyper key, so if one is relatively perverse like me and has a hyper key, it can be used to sent logo keys to the terminal without X intercepting it. --- alacritty/src/input.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'alacritty') diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs index 98a1b723..b8ae4b00 100644 --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -799,11 +799,18 @@ impl> Processor { if self.ctx.config().ui_config.alt_send_esc && *self.ctx.received_count() == 0 && self.ctx.modifiers().alt() - && utf8_len == 1 { bytes.insert(0, b'\x1b'); } + if self.ctx.modifiers().logo() + { + bytes.insert(0, b'\\'); + bytes.insert(0, b'\x1b'); + bytes.insert(0, b'@'); + bytes.insert(0, b'\x1b'); + } + self.ctx.write_to_pty(bytes); *self.ctx.received_count() += 1; -- cgit