# Getting key names for user display

**URL:** <https://discourse.glfw.org/t/getting-key-names-for-user-display/2991>\
**Category:** dev\
**Created:** [March 1, 2026, 9:20am UTC](https://discourse.glfw.org/t/getting-key-names-for-user-display/2991 "2026-03-01T09:20:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![2001herne](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/2001herne/32/1069_2.png) [@2001herne](https://discourse.glfw.org/u/2001herne)\
**Post date:** [March 1, 2026, 9:20am UTC](https://discourse.glfw.org/t/getting-key-names-for-user-display/2991/1 "2026-03-01T09:20:38Z")

</div>

This might be a bit of a hybrid support/dev question, but here goes:

As I understand it, `glfwGetKeyName()` gets the key name based on how the scancode would be represented on an EN\_US keyboard (i.e. QWERTY). It’s also subject to some fairly odd restrictions (i.e. I’d expect GLFW\_KEY\_SPACE to return `' ‘`, not `nullptr`).

Are there any plans for a `glfwGetKeyNameUserReadable()` or similar, or should I just manually build those mappings for every keyboard layout I plan to support? In the second case, dopes glfw offer any way of obtaining the keybaord layout in use?

Edit: Related, is there any plan for a `glfwGetKeyDebugName()`, i.e. give back the associated `#define` associated with a key (like, `"GLFW_KEY_ESCAPE”`?

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [March 1, 2026, 9:44am UTC](https://discourse.glfw.org/t/getting-key-names-for-user-display/2991/2 "2026-03-01T09:44:37Z")

</div>

> As I understand it, `glfwGetKeyName()` gets the key name based on how the scancode would be represented on an EN\_US keyboard (i.e. QWERTY)

This is not correct, as per the docs `glfwGetKeyName()` _returns the name of the specified printable key, encoded as UTF-8. This is typically the character that key would produce without any modifier keys, intended for displaying key bindings to the user._.

For more see the documentation:

> **[GLFW: Input reference](https://www.glfw.org/docs/3.3/group__input.html#gaeaed62e69c3bd62b7ff8f7b19913ce4f)**
>
> This is the reference documentation for input related functions and types. For more task-oriented information, see the Input guide.

> Are there any plans for a `glfwGetKeyNameUserReadable()` or similar, or should I just manually build those mappings for every keyboard layout I plan to support?

The function `glfwGetKeyName()` fulfils this purpose.

> In the second case, dopes glfw offer any way of obtaining the keybaord layout in use?

No.

> Edit: Related, is there any plan for a `glfwGetKeyDebugName()` , i.e. give back the associated `#define` associated with a key (like, `"GLFW_KEY_ESCAPE”` ?

No, however an example exists in the `get_key_name()` function in the `events.c` test: [glfw/tests/events.c at master · glfw/glfw · GitHub](https://github.com/glfw/glfw/blob/master/tests/events.c#L66-L196)
