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

alt + any key. It doesn't work. Alacritty + zellij + macOS #2051

Closed
Keeyuu opened this issue Dec 30, 2022 · 13 comments
Closed

alt + any key. It doesn't work. Alacritty + zellij + macOS #2051

Keeyuu opened this issue Dec 30, 2022 · 13 comments
Labels
bug Something isn't working

Comments

@Keeyuu
Copy link

Keeyuu commented Dec 30, 2022

I have set a meta key in Alacritty.
I use option as alt in nvim.It works very well

  • { key: N, mods: Alt, chars: "\x1bn" }

But when I enter zellij, it doesn't work. I use alt+n, alt+ any,no response, just output ˜ Like this

@Keeyuu Keeyuu added the bug Something isn't working label Dec 30, 2022
@cakir-enes
Copy link

Same goes for Warp, iTerm and kitty. It worked fine on wezterm tho

@naosense
Copy link
Contributor

Thanks for your report. If you use iterm2, #1936 may work for you. I'm not familiar with Alacritty, you can check to see if Alacritty has such a setting

@alex35mil
Copy link

For Alacritty, alacritty/alacritty#62 (comment)

@alex35mil
Copy link

alex35mil commented Jan 9, 2023

In Alacritty, the Home, End, and Insert keys also don't work. I didn't remap any of those keys anywhere.

NVM, I forgot to apply nix config.

@benvds
Copy link

benvds commented Mar 4, 2023

I've also got this problem. setting the keybindings from the alacritty issues doesn't seem to work

@bguo068
Copy link

bguo068 commented Mar 5, 2023

I had a similar issue with macOS

@merikan
Copy link

merikan commented Mar 9, 2023

To make Option key act as Alt key on Macos was fixed in v0.12.0-RC1 with the Window option option_as_alt. Using Alt+[h,j,k,l] to switch between Panes now works as expected.

window:
  option_as_alt: Both

Update 2023-03-25 Alacritty released v0.12.0

@imsnif
Copy link
Member

imsnif commented Mar 9, 2023

We recently added an FAQ for this issue specifically: https://zellij.dev/documentation/faq.html#i-am-a-macos-user-how-can-i-use-the-alt-key

@merikan - if you'd like to make a PR to the zellij website repository and add this information for Alacritty, it would be greatly appreciated!

@oriming
Copy link

oriming commented Mar 14, 2023

@merikan @alex35mil According to your configuration, after it is completed, the Alt + hjkl keys are effective, but only Alt+n does not work. It's so strange. 😣

By the way, I'm using Alacritty 0.11.0. Please help me. 🥹

@merikan
Copy link

merikan commented Mar 17, 2023

@3bluebird I'm not quite sure I understand what you mean. The option_as_alt was added to Alacritty v0.12-RC1, try to download the latest (-RC2) and see if it works.
Or did you do the keybindings in alacritty.yaml? I used to have that but the problem for me was that I am switching between ansi/us and iso/swe keyboards.
Try to start a new Alacrity session with print-events enabled alacritty --print-events | grep -i keyboardinput

Copied from Alacritty website

1. Run alacritty --print-events | grep -i keyboardinput.
2. Press problematic key bindings on such layouts, for example Alt + 8.
3. In the output you'll see something like KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 28, state: Pressed, virtual_keycode: Some(LBracket), modifiers: ALT }, is_synthetic: false } }.
4. Add a binding like - { key: LBracket, mods: Alt, chars: "[" }, the key is virtual_keycode from step 3 if it end up being None you can write key: 28, where 28 is scancode from 3.
5. Repeat 1-4 until you are done.

@oriming
Copy link

oriming commented Mar 17, 2023

@merikan Although I followed the steps of Alacritty and printed out the log information, I didn't understand it. I tried several configurations but they didn't work. I am really stupid. 🥹

My computer is macos Ventura 13.1。

The operation is Alt+n ,The following is the printed information:

[70.917475875s] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(WindowId(5410976992)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 58, state: Pressed, virtual_keycode: Some(LAlt), modifiers: ALT }, is_synthetic: false } }
[71.488687458s] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(WindowId(5410976992)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 58, state: Released, virtual_keycode: Some(LAlt), modifiers: (empty) }, is_synthetic: false } }

The configuration of Alac is as follows.

window:
  option_as_alt: Both
  padding:
    x: 10
    y: 10
  class:
    instance: Alacritty
    general: Alacritty
  opacity: 0.98

scrolling:
  history: 10000
  multiplier: 3

font:
  normal:
    family: Mononoki Nerd Font Mono
    style: Italic
  bold:
    family: JetBrainsMono Nerd Font
    style:  Bold
  italic:
    family: Mononoki Nerd Font Mono
    style:  Italic
  bold_italic:
    family: Mononoki Nerd Font Mono
    style: Bold Italic
  size: 12
  offset:
    x: 1
    y: 10
  glyph_offset:
    x: 0
    y: 5
draw_bold_text_with_bright_colors: true

import:
  - ~/.config/alacritty/.alacritty-colorscheme/themes/horizon-dark.yaml

selection:
  save_to_clipboard: false

key_bindings:
  - { key: Semicolon, mods: Control, chars: "\x1b[59;5u" }
  - { key: Period, mods: Control, chars: "\x1b[46;5u" }
  - { key: Comma, mods: Control, chars: "\x1b[44;5u" }
  - { key: Slash, mods: Control, chars: "\x1b[47;5u" }
  - { key: Space, mods: Control, chars: "\x1b[32;5u" }
  - { key: Return, mods: Control, chars: "\x1b[13;5u" }
  - { key: Return, mods: Shift, chars: "\x1b[13;2u" }
  - { key: Return, mods: Control|Shift, chars: "\x1b[13;6u" }
  - { key: N, mods: Alt, chars: "\x1bn" }
  - { key: H, mods: Alt, chars: "\x1bh" }
  - { key: J, mods: Alt, chars: "\x1bj" }
  - { key: K, mods: Alt, chars: "\x1bk" }
  - { key: L, mods: Alt, chars: "\x1bl" }
  - { key: A, mods: Alt|Shift, chars: "\x1bA" }
  - { key: B, mods: Alt|Shift, chars: "\x1bB" }
  - { key: C, mods: Alt|Shift, chars: "\x1bC" }
  - { key: D, mods: Alt|Shift, chars: "\x1bD" }
  - { key: E, mods: Alt|Shift, chars: "\x1bE" }
  - { key: F, mods: Alt|Shift, chars: "\x1bF" }
  - { key: G, mods: Alt|Shift, chars: "\x1bG" }
  - { key: H, mods: Alt|Shift, chars: "\x1bH" }
  - { key: I, mods: Alt|Shift, chars: "\x1bI" }
  - { key: J, mods: Alt|Shift, chars: "\x1bJ" }
  - { key: K, mods: Alt|Shift, chars: "\x1bK" }
  - { key: L, mods: Alt|Shift, chars: "\x1bL" }
  - { key: M, mods: Alt|Shift, chars: "\x1bM" }
  - { key: N, mods: Alt|Shift, chars: "\x1bN" }
  - { key: O, mods: Alt|Shift, chars: "\x1bO" }
  - { key: P, mods: Alt|Shift, chars: "\x1bP" }
  - { key: Q, mods: Alt|Shift, chars: "\x1bQ" }
  - { key: R, mods: Alt|Shift, chars: "\x1bR" }
  - { key: S, mods: Alt|Shift, chars: "\x1bS" }
  - { key: T, mods: Alt|Shift, chars: "\x1bT" }
  - { key: U, mods: Alt|Shift, chars: "\x1bU" }
  - { key: V, mods: Alt|Shift, chars: "\x1bV" }
  - { key: W, mods: Alt|Shift, chars: "\x1bW" }
  - { key: X, mods: Alt|Shift, chars: "\x1bX" }
  - { key: Y, mods: Alt|Shift, chars: "\x1bY" }
  - { key: Z, mods: Alt|Shift, chars: "\x1bZ" }
  - { key: Key1,  mods: Alt, chars: "\x1b1" }
  - { key: Key2,  mods: Alt, chars: "\x1b2" }
  - { key: Key3,  mods: Alt, chars: "\x1b3" }
  - { key: Key4,  mods: Alt, chars: "\x1b4" }
  - { key: Key5,  mods: Alt, chars: "\x1b5" }
  - { key: Key6,  mods: Alt, chars: "\x1b6" }
  - { key: Key7,  mods: Alt, chars: "\x1b7" }
  - { key: Key8,  mods: Alt, chars: "\x1b8" }
  - { key: Key9,  mods: Alt, chars: "\x1b9" }
  - { key: Key0,  mods: Alt, chars: "\x1b0" }
  - { key: LBracket,  mods: Alt,    chars: "\x1b[" }
  - { key: RBracket,  mods: Alt,    chars: "\x1b]" }
  - { key: Minus,     mods: Alt,    chars: "\x1b-" }
  - { key: Equals,    mods: Alt,    chars: "\x1b=" }
  - { key: Grave,     mods: Alt,    chars: "\x1b`"  } 
  - { key: Period,    mods: Alt,    chars: "\x1b."  } 
  - { key: Backslash, mods: Alt,    chars: "\x1b\\" } 
  - { key: Space,    mods: Control, chars: "\x00" }
  - { key: Grave,     mods: Alt|Shift, chars: "\x1b~"  } 
  - { key: Key8,      mods: Alt|Shift, chars: "\x1b*"  } 
  - { key: Key3,      mods: Alt|Shift, chars: "\x1b#"  } 
  - { key: Period,    mods: Alt|Shift, chars: "\x1b>"  } 
  - { key: Comma,     mods: Alt|Shift, chars: "\x1b<"  } 
  - { key: Minus,     mods: Alt|Shift, chars: "\x1b_"  } 
  - { key: Key5,      mods: Alt|Shift, chars: "\x1b%"  } 
  - { key: Key6,      mods: Alt|Shift, chars: "\x1b^"  } 
  - { key: Backslash, mods: Alt|Shift, chars: "\x1b|"  } 

@merikan
Copy link

merikan commented Mar 17, 2023

@3bluebird
Strange, it looks like it didn't send the n key
Are you using the latest Alacritty rc version?

I'm using Alacritty v0.12.0-rc with the config value option_as_alt: Both
When I start Alacritty with print-event and press Option+n I get the following output:

1. [54.333594328s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(140174797402112)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 58, state: Pressed, virtual_keycode: Some(LAlt), modifiers: ALT }, is_synthetic: false } }
2. [58.782553420s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(140174797402112)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 45, state: Pressed, virtual_keycode: Some(N), modifiers: ALT }, is_synthetic: false } }
3. [58.902289590s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(140174797402112)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 45, state: Released, virtual_keycode: Some(N), modifiers: ALT }, is_synthetic: false } }
4. [59.625484260s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(140174797402112)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 58, state: Released, virtual_keycode: Some(LAlt), modifiers: (empty) }, is_synthetic: false } }

Look at the Some element and you will see LAlt (left option) and N
The first two have State: Pressed and the other two has Released

Have you tried to remove all your keybindings in Alacaritty just to be sure?

@oriming
Copy link

oriming commented Mar 18, 2023

@merikan Haha, after switching to Alacritty v0.12.0-rc, the problem was fixed. I extend my sincerest thanks to you, thank you! 🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants