alacritty
alacritty copied to clipboard
key bindings in windows (mapping Ctrl+Space)
Using alacritty (downloaded from the appveyor link) on windows and have some issues/questions about key bindings.
- bash shortcuts using Alt key are not working - is this expected?
I added a few mappings to the config file that gets me some of what I most commonly use, but however I still miss several other important ones that I don't know how to map (
Alt+.for instance, and others).
Should this work out of the box, or if not, can a canned list of such mappings be made available for those who might want to add it to their configs optionally. One I sorely miss and don't know how to map isCtrl+Alt+ewhich binds to expanding aliases.
- { key: D, mods: Alt, chars: "\x1bd" }
- { key: B, mods: Alt, chars: "\x1bb" }
- { key: F, mods: Alt, chars: "\x1bf" }
- In tmux I use Space as my prefix key.
set -g prefix C-SpaceI've tried different things (blindly) in the config file and couldn't get this to work. Any pointers on how to achieve this mapping?
Off topic, but on windows, alacritty doesn't honor any of the command line arguments for me. I've seen other folks refer to using this even on windows, so somehow it is specific to my setup I assume. i.e. if I run alacritty.exe -vvv it spawns the terminal but there is no debug output, or if I do alacritty.exe --help the command just returns without any output.
Thanks!
Thank you @zacps for all the effort you've put into the windows port!
Thanks!
Regarding the console output are you using a build from a7e59d39 or later? There was a change made which should fix console output.
Keybindings are not something I've tested much. I don't know how 'special' actions like expanding aliases are triggered.
It's possible that this might need to wait for https://github.com/jwilm/alacritty/issues/1661, because currently all input to Alacritty has to pass through:
Alacritty => WinPTY => CONHOST(cmd) => Shell(User specified)
And if any part of that chain doesn't understand the input it'll probably just get dropped (CONHOST being the worst offender).
I'd suggest trying these things in a bare wsl prompt to see if they work first, then we can go from there.
Not being able to map Control+Space kills me as that's my tmux prefix, and I just cannot get it to work (even in bare wsl). Not sure if this is Windows specific, or if I am just not setting up the mapping correctly. I've tried this to no avail:
- { key: Space, mods: Control, chars: "\x00" }
I managed to get Alt+. working using the mapping:
- { key: Period, mods: Alt, chars: "\x1b." }
BTW, I moved up to the latest rev from Appveyor and that resolved the console output issue! Thanks again.
Found a few past references to using Ctrl+Space, most of them duped to https://github.com/jwilm/alacritty/issues/99, however the popular solution referenced in there doesn't work for me on Windows, it's the one I referenced above, but I'll include the mapping below again.
- { key: Space, mods: Control, chars: "\x00" }
Not sure if this is Windows specific or my setup specific. Would be great if someone can test this out in their setup..
If you can't get it to work in bare wsl it's extremely unlikely we'll be able to solve it in alacritty (Might be worth creating an issue in Microsoft/console).
You're welcome to keep investigating this but I'm probably not going to give it much attention anytime soon.
Not sure if it's related, but Alt Gr is not working in Alacritty (eg. can't type @ on Azerty) Works fine in other terminals
@fculpo See https://github.com/jwilm/alacritty/issues/1681
If you can't get it to work in bare wsl it's extremely unlikely we'll be able to solve it in alacritty
I can confirm that this works as expected in cmd and powershell running wsl. i.e. I'm able to set C-Space as my tmux prefix key and it works without any issues.
I assume this is what you were referring to when you say "bare wsl"?
Seems specific to Windows alacritty given https://github.com/jwilm/alacritty/issues/99 seems to resolve for other platform(s). FWIW, pretty easy to repro in a couple of steps:
- run
tmuxin bash - set prefix by doing:
tmux set -g prefix C-Space - now type
C-spacefollowed by%- this if it works successfully will split the terminal into two vertical panes, otherwise it would enter the%orSpacecharacter literally as it does on Windows alacritty.
Ran with --print-events to see what the key press events captured by alacritty. Looks like alacritty is picking up the key presses fine but they're potentially getting dropped on the floor somewhere without getting passed on to bash/tmux? Either that, or the mapping in alacritty.yml is not correct/working.
glutin event: DeviceEvent { device_id: DeviceId(DeviceId(462556243)), event: Key(KeyboardInput { scancode: 29, state: Pressed, virtual_keycode: Some(LControl), modifiers: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } }) }
glutin event: WindowEvent { window_id: WindowId(WindowId(0x12d0f6e)), event: KeyboardInput { device_id: DeviceId(DeviceId(0)), input: KeyboardInput { scancode: 29, state: Pressed, virtual_keycode: Some(LControl), modifiers: ModifiersState { shift: false, ctrl: true, alt: false, logo: false } } } }
glutin event: DeviceEvent { device_id: DeviceId(DeviceId(462556243)), event: Key(KeyboardInput { scancode: 57, state: Pressed, virtual_keycode: Some(Space), modifiers: ModifiersState { shift: false, ctrl: true, alt: false, logo: false } }) }
glutin event: WindowEvent { window_id: WindowId(WindowId(0x12d0f6e)), event: KeyboardInput { device_id: DeviceId(DeviceId(0)), input: KeyboardInput { scancode: 57, state: Pressed, virtual_keycode: Some(Space), modifiers: ModifiersState { shift: false, ctrl: true, alt: false, logo: false } } } }
glutin event: WindowEvent { window_id: WindowId(WindowId(0x12d0f6e)), event: ReceivedCharacter(' ') }
glutin event: Awakened
glutin event: DeviceEvent { device_id: DeviceId(DeviceId(462556243)), event: Key(KeyboardInput { scancode: 57, state: Released, virtual_keycode: Some(Space), modifiers: ModifiersState { shift: false, ctrl: true, alt: false, logo: false } }) }
glutin event: WindowEvent { window_id: WindowId(WindowId(0x12d0f6e)), event: KeyboardInput { device_id: DeviceId(DeviceId(0)), input: KeyboardInput { scancode: 57, state: Released, virtual_keycode: Some(Space), modifiers: ModifiersState { shift: false, ctrl: true, alt: false, logo: false } } } }
glutin event: DeviceEvent { device_id: DeviceId(DeviceId(462556243)), event: Key(KeyboardInput { scancode: 29, state: Released, virtual_keycode: Some(LControl), modifiers: ModifiersState { shift: false, ctrl: true, alt: false, logo: false } }) }
glutin event: WindowEvent { window_id: WindowId(WindowId(0x12d0f6e)), event: KeyboardInput { device_id: DeviceId(DeviceId(0)), input: KeyboardInput { scancode: 29, state: Released, virtual_ke
Still not sure how to map ctrl+space in windows, but closing this issue since there doesn't seem any open action here.
Burned by this on Windows, sad to see this closed. 😭
@damnskippy Did you ever happen to solve this issue? Currently having the same problem (but trying to use ctrl+space in Vim rather than in tmux). I see the Ubuntu WSL app handles Ctrl+space fine, as well as WSLtty, but sadly no luck in Ubuntu. Temporary fix for me will be to remap my Ctrl+space in Windows to something else (thankfully I don't use Ctrl+space for much) but far from ideal.
+1. It's a bummer for Emacs users. ctrl+space is the equivalent of v in vim.
Indeed ! So sad C-Space does not work since in emacs its such an important key combination... I wish it would work so I would not be forced to use microsoft terminal.
Could we get this issue reopened please? ctrl+space is working fine in wsl, with windows terminal, powershell, and cmd.exe.
Show us alacritty --print-events when you press ctrl + space? In general we can't do much about issues on Windows, since it's not up to us, but up to WinPty/Conpty.
https://github.com/alacritty/alacritty/issues/1703#issuecomment-433476493 User damnskippy's comment above worked for me with Alacritty on Win10. In case it's relevant, I'm launching Alacritty into WSL with
shell:
program: bash
args:
- -c tmux
For the lazy, damnskippy's fix was this: - { key: Space, mods: Control, chars: "\x00" }
I also see some mentions of configuring tmux like
set -g prefix C-Space
unbind C-Space
bind C-Space send-prefix
That middle "unbind" line is new to me, and may or may not be important for your setup.
Just in case there's some other mystery config I have interacting with this that I'm not aware of, all my configs are here: https://github.com/Akaito/configfiles
Today I changed my shell on a remote server to ZSH (probably not related but that was the last thing I did) and my Control-Space binding completely stopped working. I tried to apply damnskippy's fix but to no avail. In fact, it would seem that Alacritty is not detecting anything when I press Control-Space. I can change the chars in that fix to any sequence of characters, but no matter what I do, pressing Control-Space just yields ^\ in the terminal.
I have alacritty running with shell.program: wsl. The keybinding works with no issues or configuration whatsoever when I try it in the default WSL terminal.
I cannot run alacritty --print-events as it errors out with Failed to initalize any backend!.
I am truly at a loss as to how this started happening, but I can provide any relevant info if needed.
Ctrl + Space is not getting passed for me.
Host: Windows
ssh'ing to ubuntu vm, shell is bash and the mapping shown in previous post makes no difference. showkey -a doesn't show anything being pressed
This is broken, the fix does not work for me either. The interesting thing is the exact same setup / configurations work perfectly fine with the latest Windows Terminal so it's surely something in Alacritty itself.
If Alacritty's output contains ReceivedCharacter('\u{0}') when running alacritty --print-events | grep "ReceivedCharacter", then this is a Windows bug.
If it doesn't contain that for you, please let me know.
I am getting the following when doing Control + Space:
[2020-08-07 09:42:46.458983200] [INFO] glutin event: WindowEvent { window_id: WindowId(WindowId(0x620714)), event: ReceivedCharacter(' ') }
@sharksforarms Looks like it should just print a space for you?
@davidhewitt / @cole-h could you confirm this? Does Alacritty not receive the correct character here?
@chris-morgan @ShalokShalom It is actually just printing a space, and I also have the same logs.
If I bind C-Space to send "\x00", it not work:
D:\>xxd -psd
a # press ctrl-space, a, enter
610d0a
But if I bind C-Space to send "\x02" (i.e. C-b), it works:
D:\>xxd -psd
^Ba # press ctrl-space, a, enter
02610d0a
A workaround for tmux: use C-b as tmux's prefix key and bind C-Space to "\x02" in alacritty.
@chris-morgan @ShalokShalom It is actually just printing a space, and I also have the same logs.
What do I have to do with it?
I'd assume this was intended for sharksforarms.