Repository: alacritty/alacritty (language: rust)

Issue:
Missing binding key NumpadDecimal
I've noticed that the `NumpadDecimal` is not accepted as a keyboard binding key in the config file.

Log errors from issues such as #6748, #4506 or #4509  make me think that this was accepted at some point.

It seems that just adding a
 ```rust
"NumpadDecimal" => (Key::Character(".".into()), KeyLocation::Numpad),
```
 in [`alacritty/src/config/bindings.rs` in the matching of the keycode from lines 669 to 728](https://github.com/alacritty/alacritty/blob/2d2b894c3b869fadc78fce9d72cb5c8d2b764cac/alacritty/src/config/bindings.rs#L669-L728) does the trick.
Hangs on startup
OS: Linux
Version: alacritty 0.13.1
Wayland (ChromeOS 121.0.6167.131 beta)

Alacritty is hanging on startup. This started with version 0.13. It sometimes starts successfully, about 15% of the time, but otherwise it hangs in the same place every time:

<details>
<summary>WAYLAND_DEBUG=1 alacritty --print-events -vvv --config-file /dev/null</summary>

```
¶ WAYLAND_DEBUG=1 alacritty --print-events -vvv --config-file /dev/null
[4010321.829]  -> wl_display@1.get_registry(new id wl_registry@2)
[4010321.986]  -> wl_display@1.sync(new id wl_callback@3)
[4010422.972] wl_display@1.delete_id(3)
[4010424.223] wl_registry@2.global(1, "wl_compositor", 4)
[4010424.440] wl_registry@2.global(2, "wl_shm", 1)
[4010424.463] wl_registry@2.global(3, "wl_drm", 2)
[4010424.475] wl_registry@2.global(4, "wl_subcompositor", 1)
[4010424.485] wl_registry@2.global(5, "wl_output", 3)
[4010424.497] wl_registry@2.global(6, "wl_data_device_manager", 3)
[4010424.507] wl_registry@2.global(7, "wp_fractional_scale_manager_v1", 1)
[4010424.517] wl_registry@2.global(8, "wp_viewporter", 1)
[4010424.526] wl_registry@2.global(9, "zwp_tablet_manager_v2", 1)
[4010424.537] wl_registry@2.global(10, "wl_seat", 5)
[4010424.546] wl_registry@2.global(11, "gtk_shell1", 1)
[4010424.557] wl_registry@2.global(12, "wl_shell", 1)
[4010424.566] wl_registry@2.global(13, "zwp_pointer_constraints_v1", 1)
[4010424.575] wl_registry@2.global(14, "zwp_relative_pointer_manager_v1", 1)
[4010424.586] wl_registry@2.global(15, "zwp_idle_inhibit_manager_v1", 1)
[4010424.595] wl_registry@2.global(16, "zwp_text_input_manager_v1", 1)
[4010424.706] wl_registry@2.global(17, "zcr_text_input_crostini_manager_v1", 1)
[4010424.731] wl_registry@2.global(18, "zcr_text_input_x11_v1", 1)
[4010424.743] wl_registry@2.global(19, "zcr_text_input_extension_v1", 11)
[4010424.756] wl_registry@2.global(20, "xdg_wm_base", 3)
[4010424.766] wl_callback@3.done(19267)
[4010425.304]  -> wl_registry@2.bind(1, "wl_compositor", 4, new id [unknown]@3)
[4010425.677]  -> wl_registry@2.bind(4, "wl_subcompositor", 1, new id [unknown]@4)
[4010425.802]  -> wl_registry@2.bind(5, "wl_output", 3, new id [unknown]@5)
[4010425.935]  -> wl_registry@2.bind(10, "wl_seat", 5, new id [unknown]@6)
[4010425.992]  -> wl_registry@2.bind(7, "wp_fractional_scale_manager_v1", 1, new id [unknown]@7)
[4010426.017]  -> wl_registry@2.bind(8, "wp_viewporter", 1, new id [unknown]@8)
[4010426.102]  -> wl_registry@2.bind(2, "wl_shm", 1, new id [unknown]@9)
[4010426.124]  -> wl_registry@2.bind(20, "xdg_wm_base", 3, new id [unknown]@10)
[4010426.149]  -> wl_registry@2.bind(14, "zwp_relative_pointer_manager_v1", 1, new id [unknown]@11)
[4010426.166]  -> wl_registry@2.bind(13, "zwp_pointer_constraints_v1", 1, new id [unknown]@12)
[4010426.193]  -> wl_display@1.sync(new id wl_callback@13)
[4010433.157] wl_output@5.geometry(0, 0, 260, 146, 0, "unknown", "unknown", 0)
[4010433.274] wl_output@5.mode(3, 1366, 768, 60000)
[4010433.312] wl_output@5.scale(1)
[4010433.328] wl_output@5.done()
[4010433.339] wl_seat@6.name("default")
[4010433.475] wl_seat@6.capabilities(7)
[4010433.559]  -> wl_seat@6.get_keyboard(new id wl_keyboard@14)
[4010462.791]  -> wl_compositor@3.create_surface(new id wl_surface@15)
[4010462.912]  -> wl_seat@6.get_pointer(new id wl_pointer@16)
[4010470.037]  -> zwp_relative_pointer_manager_v1@11.get_relative_pointer(new id zwp_relative_pointer_v1@17, wl_pointer@16)
[4010470.195]  -> wl_seat@6.get_touch(new id wl_touch@18)
[4010471.610] wl_display@1.delete_id(13)
[4010471.786] wl_shm@9.format(842094158)
[4010471.812] wl_shm@9.format(875708993)
[4010471.822] wl_shm@9.format(875709016)
[4010471.831] wl_shm@9.format(0)
[4010471.839] wl_shm@9.format(1)
[4010471.846] wl_shm@9.format(909199186)
[4010471.854] wl_callback@13.done(19267)
Created log file at "/tmp/Alacritty-8413.log"
[0.000034000s] [INFO ] [alacritty] Welcome to Alacritty
[0.004455077s] [INFO ] [alacritty] Version 0.13.1
[0.004718847s] [INFO ] [alacritty] Running on Wayland
[0.008538847s] [INFO ] [alacritty] Configuration files loaded from:
                                     "/dev/null"
[0.032246231s] [INFO ] [alacritty] winit event: NewEvents(Init)
[0.032501385s] [INFO ] [alacritty] winit event: Resumed
[4010512.258]  -> wl_display@1.get_registry(new id wl_registry@13)
[4010512.399]  -> wl_display@1.sync(new id wl_callback@19)
[4010515.932] wl_registry@13.global(1, "wl_compositor", 4)
[4010516.057] wl_registry@13.global(2, "wl_shm", 1)
[4010516.495] wl_registry@13.global(3, "wl_drm", 2)
[4010516.564] wl_registry@13.global(4, "wl_subcompositor", 1)
[4010516.593] wl_registry@13.global(5, "wl_output", 3)
[4010516.678] wl_registry@13.global(6, "wl_data_device_manager", 3)
[4010516.717] wl_registry@13.global(7, "wp_fractional_scale_manager_v1", 1)
[4010516.746] wl_registry@13.global(8, "wp_viewporter", 1)
[4010516.771] wl_registry@13.global(9, "zwp_tablet_manager_v2", 1)
[4010516.860] wl_registry@13.global(10, "wl_seat", 5)
[4010516.901] wl_registry@13.global(11, "gtk_shell1", 1)
[4010516.947] wl_registry@13.global(12, "wl_shell", 1)
[4010516.974] wl_registry@13.global(13, "zwp_pointer_constraints_v1", 1)
[4010516.999] wl_registry@13.global(14, "zwp_relative_pointer_manager_v1", 1)
[4010517.026] wl_registry@13.global(15, "zwp_idle_inhibit_manager_v1", 1)
[4010517.052] wl_registry@13.global(16, "zwp_text_input_manager_v1", 1)
[4010517.077] wl_registry@13.global(17, "zcr_text_input_crostini_manager_v1", 1)
[4010517.103] wl_registry@13.global(18, "zcr_text_input_x11_v1", 1)
[4010517.129] wl_registry@13.global(19, "zcr_text_input_extension_v1", 11)
[4010517.154] wl_registry@13.global(20, "xdg_wm_base", 3)
[4010522.178] wl_display@1.delete_id(19)
[4010522.274] wl_callback@19.done(19267)
[4010522.467]  -> wl_registry@13.bind(6, "wl_data_device_manager", 3, new id [unknown]@19)
[4010522.541]  -> wl_registry@13.bind(10, "wl_seat", 5, new id [unknown]@20)
[4010524.239] wl_seat@20.name("default")
[4010524.368] wl_seat@20.capabilities(7)
[4010524.430]  -> wl_seat@20.get_keyboard(new id wl_keyboard@21)
[4010524.476]  -> wl_data_device_manager@19.get_data_device(new id wl_data_device@22, wl_seat@20)
[4010524.549]  -> wl_seat@20.get_pointer(new id wl_pointer@23)
[4010536.527] wl_keyboard@21.keymap(1, fd 17, 47395)
[4010536.655] wl_keyboard@21.repeat_info(20, 500)
[4010545.792]  -> wl_display@1.get_registry(new id wl_registry@24)
[4010545.898]  -> wl_display@1.sync(new id wl_callback@25)
[4010546.560] wl_registry@24.global(1, "wl_compositor", 4)
[4010546.675] wl_registry@24.global(2, "wl_shm", 1)
[4010546.691] wl_registry@24.global(3, "wl_drm", 2)
[4010546.703] wl_registry@24.global(4, "wl_subcompositor", 1)
[4010546.713] wl_registry@24.global(5, "wl_output", 3)
[4010546.721] wl_registry@24.global(6, "wl_data_device_manager", 3)
[4010546.731] wl_registry@24.global(7, "wp_fractional_scale_manager_v1", 1)
[4010546.740] wl_registry@24.global(8, "wp_viewporter", 1)
[4010546.750] wl_registry@24.global(9, "zwp_tablet_manager_v2", 1)
[4010546.759] wl_registry@24.global(10, "wl_seat", 5)
[4010546.767] wl_registry@24.global(11, "gtk_shell1", 1)
[4010546.776] wl_registry@24.global(12, "wl_shell", 1)
[4010546.785] wl_registry@24.global(13, "zwp_pointer_constraints_v1", 1)
[4010546.794] wl_registry@24.global(14, "zwp_relative_pointer_manager_v1", 1)
[4010546.803] wl_registry@24.global(15, "zwp_idle_inhibit_manager_v1", 1)
[4010546.831] wl_registry@24.global(16, "zwp_text_input_manager_v1", 1)
[4010546.862] wl_registry@24.global(17, "zcr_text_input_crostini_manager_v1", 1)
[4010546.876] wl_registry@24.global(18, "zcr_text_input_x11_v1", 1)
[4010546.887] wl_registry@24.global(19, "zcr_text_input_extension_v1", 11)
[4010546.897] wl_registry@24.global(20, "xdg_wm_base", 3)
[4010552.773] wl_display@1.delete_id(25)
[4010552.792] wl_callback@25.done(19267)
[4010552.974]  -> wl_display@1.sync(new id wl_callback@25)
[4010555.851] wl_display@1.delete_id(25)
[4010555.878] wl_callback@25.done(19267)
[4010556.026]  -> wl_registry@24.bind(3, "wl_drm", 2, new id [unknown]@25)
[4010556.072]  -> wl_display@1.sync(new id wl_callback@26)
[4010561.090] wl_drm@25.format(875708993)
[4010561.232] wl_drm@25.format(875709016)
[4010561.154] wl_display@1.delete_id(26)
[4010561.250] wl_drm@25.format(875713089)
[4010561.324] wl_drm@25.format(875713112)
[4010561.337] wl_drm@25.format(909199186)
[4010561.347] wl_drm@25.device("/dev/dri/renderD128")
[4010562.279] wl_drm@25.capabilities(1)
[4010563.953] wl_callback@26.done(19267)
[0.248281847s] [INFO ] [alacritty] Using EGL 1.4
[0.248596000s] [DEBUG] [alacritty] Picked GL Config:
                                     buffer_type: Some(Rgb { r_size: 8, g_size: 8, b_size: 8 })
                                     alpha_size: 8
                                     num_samples: 0
                                     hardware_accelerated: true
                                     supports_transparency: Some(true)
                                     config_api: Api(OPENGL | GLES1 | GLES2 | GLES3)
                                     srgb_capable: true
[4010722.450]  -> wl_compositor@3.create_surface(new id wl_surface@26)
[4010722.542]  -> xdg_wm_base@10.get_xdg_surface(new id xdg_surface@27, wl_surface@26)
[4010722.586]  -> xdg_surface@27.get_toplevel(new id xdg_toplevel@28)
[4010722.662]  -> wp_viewporter@8.get_viewport(new id wp_viewport@29, wl_surface@26)
[4010722.703]  -> wp_fractional_scale_manager_v1@7.get_fractional_scale(new id wp_fractional_scale_v1@30, wl_surface@26)
[4010722.729]  -> wl_surface@26.set_opaque_region(nil)
[4010722.749]  -> xdg_toplevel@28.set_app_id("Alacritty")
[4010722.762]  -> xdg_toplevel@28.set_title("Alacritty")
[4010722.777]  -> xdg_toplevel@28.set_min_size(2, 1)
[4010722.803]  -> xdg_toplevel@28.set_max_size(0, 0)
[4010722.840]  -> wl_surface@26.commit()
[4010722.883]  -> wl_display@1.sync(new id wl_callback@31)
[4010722.916] wl_keyboard@14.keymap(1, fd 16, 47395)
[4010722.936] wl_keyboard@14.repeat_info(20, 500)
[4010731.802] wl_surface@26.enter(wl_output@5)
[4010733.809] wp_fractional_scale_v1@30.preferred_scale(120)
[4010733.896] xdg_toplevel@28.configure(0, 0, array[0])
[4010733.917] xdg_surface@27.configure(19268)
[4010733.987]  -> xdg_surface@27.ack_configure(19268)
[4010738.591] wl_display@1.delete_id(31)
[0.275902154s] [ERROR] [sctk_adwaita] XDG Settings Portal did not return response in time: timeout: 100ms, key: color-scheme
[4010748.851]  -> wl_shm@9.create_pool(new id wl_shm_pool@32, fd 23, 1)
[4010749.007]  -> wl_compositor@3.create_surface(new id wl_surface@33)
[4010749.108]  -> wl_subcompositor@4.get_subsurface(new id wl_subsurface@34, wl_surface@33, wl_surface@26)
[4010749.139]  -> wl_subsurface@34.set_sync()
[4010749.182]  -> wl_compositor@3.create_surface(new id wl_surface@35)
[4010749.221]  -> wl_subcompositor@4.get_subsurface(new id wl_subsurface@36, wl_surface@35, wl_surface@26)
[4010749.265]  -> wl_subsurface@36.set_sync()
[4010749.281]  -> wl_compositor@3.create_surface(new id wl_surface@37)
[4010749.332]  -> wl_subcompositor@4.get_subsurface(new id wl_subsurface@38, wl_surface@37, wl_surface@26)
[4010749.362]  -> wl_subsurface@38.set_sync()
[4010749.381]  -> wl_compositor@3.create_surface(new id wl_surface@39)
[4010749.400]  -> wl_subcompositor@4.get_subsurface(new id wl_subsurface@40, wl_surface@39, wl_surface@26)
[4010749.435]  -> wl_subsurface@40.set_sync()
[4010749.456]  -> wl_compositor@3.create_surface(new id wl_surface@41)
[4010749.489]  -> wl_subcompositor@4.get_subsurface(new id wl_subsurface@42, wl_surface@41, wl_surface@26)
[4010749.513]  -> wl_subsurface@42.set_sync()
[0.389990231s] [TRACE] [crossfont] Number of fonts is 182
[0.390342770s] [TRACE] [crossfont] Got font path="/usr/share/fonts/truetype/noto/NotoSans-Bold.ttf", index=0
[0.390720154s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT, render_mode: "Normal", lcd_filter: 1 }
[4010886.693]  -> wl_surface@26.set_opaque_region(nil)
[4010886.783]  -> xdg_surface@27.set_window_geometry(0, -35, 800, 635)
[4010886.801]  -> wp_viewport@29.set_destination(800, 600)
[4010886.827] wl_callback@31.done(19268)
^C
```
</details>

The relevant lines:

```
[4010733.809] wp_fractional_scale_v1@30.preferred_scale(120)
[4010733.896] xdg_toplevel@28.configure(0, 0, array[0])
[4010733.917] xdg_surface@27.configure(19268)
[4010733.987]  -> xdg_surface@27.ack_configure(19268)
[4010738.591] wl_display@1.delete_id(31)
…
[4010886.827] wl_callback@31.done(19268)
```

If you're clever, you can spot the bug from here, especially when compared to a successful run.

```
[ 547457.855] wl_display@1.delete_id(31)
[ 547457.881] wp_fractional_scale_v1@30.preferred_scale(120)
[ 547458.012] xdg_toplevel@28.configure(0, 0, array[0])
[ 547458.051] xdg_surface@23.configure(22088)
[ 547458.067] wl_callback@31.done(22088)
[ 547458.123]  -> xdg_surface@23.ack_configure(22088)
```

In that 150ms gap, a different thread drove wayland-backend into a deadlock.

This starts with commit https://github.com/alacritty/alacritty/commit/80d4daccc307622f8e604af4f36ac89ecccf5db7, and can be further isolated to just the copypasta update. The copypasta update can be isolated to https://github.com/alacritty/copypasta/commit/6bc2ea66f108a21f0009b315438c286371cafbf0, a smithay-clipboard update. The relevant smithay-clipboard commit is https://github.com/Smithay/smithay-clipboard/commit/31392200dcecbeb17672ee735ff2fc92620fa379, which overhauls the entire event loop handling.

The previous version of smithay-clipboard was polling every 50ms; the current version dispatches the event queue properly. As such, events can be delivered to the main queue when the main thread is not the one performing the read, and we hit a deadlock in wayland-rs.

https://github.com/Smithay/wayland-rs/blob/2d5e7df99f896fadcd0165f4d958fcb6b43522cb/wayland-client/src/event_queue.rs#L464-L483

The `Err` result of `dispatch_inner_queue` is ignored as documented, but if it returns `Ok` with something greater than 0, that is ignored. This causes `blocking_dispatch` to assume that there were no pendings events and so it should block until there are some. That causes this loop to get stuck, as `done` is true but we're blocking on the read:

https://github.com/Smithay/wayland-rs/blob/2d5e7df99f896fadcd0165f4d958fcb6b43522cb/wayland-client/src/event_queue.rs#L430-L432

And indeed, if I adjust the scale factor on my system, it unblocks and finishes starting up.

It's unclear to me why `dispatching_impl` needs to read the queue in two different ways, or whether smithay-clipboard or alacritty are somehow violating the threading requirements of wayland-rs, but this patch fixes it for me. https://github.com/Smithay/wayland-rs/pull/695


Discussion / hints:

I am facing the same issue on [Hyprland](https://hyprland.org/). I'm running `alacritty 0.13.1 (fe2a3c56)`.
Hi,

On one of my systems with Alacritty (0.13.1 (fe2a3c56)) is also hanging on start (Wayland session). When I sign into Gnome with X11 Alacritty does not hang. 

So what I observed is if I launch another application first (e.g. Geany text editor) then Alacritty I can successfully get Alacritty to show a prompt.

**Steps:**
1. Sign into Gnome Wayland Session.
2. Launch Geany.
3. Launch Alacritty.

Actual Result:
Alacritty will show command prompt in ZSH shell.

If you repeat the above test, does Alacritty no longer freeze?
gnome issue is a bit different #7465.

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7ac53941ea0..20741f51877 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 - Vi inline search/semantic selection expanding across newlines
 - C0 and C1 codes being emitted in associated text when using kitty keyboard
 - Occasional hang on startup with some Wayland compositors
+- Missing key for `NumpadDecimal` in key bindings
 
 ### Changed
 
diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs
index 9940cb5b747..57225e26fef 100644
--- a/alacritty/src/config/bindings.rs
+++ b/alacritty/src/config/bindings.rs
@@ -704,6 +704,7 @@ impl<'a> Deserialize<'a> for BindingKey {
                         "NumpadEnter" => (Key::Named(NamedKey::Enter), KeyLocation::Numpad),
                         "NumpadAdd" => (Key::Character("+".into()), KeyLocation::Numpad),
                         "NumpadComma" => (Key::Character(",".into()), KeyLocation::Numpad),
+                        "NumpadDecimal" => (Key::Character(".".into()), KeyLocation::Numpad),
                         "NumpadDivide" => (Key::Character("/".into()), KeyLocation::Numpad),
                         "NumpadEquals" => (Key::Character("=".into()), KeyLocation::Numpad),
                         "NumpadSubtract" => (Key::Character("-".into()), KeyLocation::Numpad),
diff --git a/extra/man/alacritty.5.scd b/extra/man/alacritty.5.scd
index d5f12554dde..f42b74e349a 100644
--- a/extra/man/alacritty.5.scd
+++ b/extra/man/alacritty.5.scd
@@ -739,8 +739,8 @@ This section documents the *[keyboard]* table of the configuration file.
 _https://docs.rs/winit/latest/winit/keyboard/enum.Key.html#variant.Dead_
 
 		Numpad keys are prefixed by _Numpad_: _"NumpadEnter"_ | _"NumpadAdd"_ |
-		_"NumpadComma"_ | _"NumpadDivide"_ | _"NumpadEquals"_ | _"NumpadSubtract"_ |
-		_"NumpadMultiply"_ | _"Numpad[0-9]"_.
+		_"NumpadComma"_ | _"NumpadDecimal"_ | _"NumpadDivide"_ | _"NumpadEquals"_ |
+		_"NumpadSubtract"_ | _"NumpadMultiply"_ | _"Numpad[0-9]"_.
 
 		The _key_ field also supports using scancodes, which are specified as a
 		decimal number.


Test patch: