Script editor ignores numpad DEL key - WORKAROUND FOUND

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By TribalTalker

I’m just learning Godot and in my first script I found that the numpad DEL key is not functioning. Works fine in other apps like Firefox, PyCharm and gedit.

OS: Linux Pop! 22.04 LTS
Godot: v3.5.stable.flathub [991bb6ac7]
Hardware: Asus Tuf Gaming laptop FX705DY.

The numpad DEL is a key I use a lot and it’s a deal breaker for the script editor.
Does anyone have a fix?

[EDIT] Pressing the DEL key stops the cursor from blinking, so the keystroke is detected but seems not to be bound to an action. I tried swapping away from the EN language setting (to ES) and it made no difference.

[Further edit] The “Project Settings/Input Map” allows me to see that the app can read “KP Period” being pressed.

[Workaround Found]
Remap the ignored key - see Remap custom keyboard keys in Linux - Tutorial

Sounds like a bug to me. I tried (win 10) and it works… There seems to be bug report about it: Delete and Insert keys do not work at all, Shift+arrow selects text permanetly · Issue #56829 · godotengine/godot · GitHub

aXu_AP | 2022-09-09 18:52

A workaround could be remapping numpad del key to usual del key. Or if you are handy with c++ you could try fixing it yourself - as it seems that the bug affects small amount of users it takes longer for someone to take it on.

aXu_AP | 2022-09-09 18:58

Thank you - not just me then!

TribalTalker | 2022-09-09 19:06

Good idea, I’ll look into that. I had to do something similar years ago on Win7 when my keyboard was harvested, key by key, by a very small and unsupervised child. I never got all the keys back.

TribalTalker | 2022-09-09 19:10

So a workaround is to use the xev command on the console, press the numpad-delete, press the normal delete, view the two outputs.
From this i got a keysym value of 0xff9f for my numpad-delete and a name for the normal delete of “Delete”.
Then use the xmodmap command:
xmodmap -e “keysym 0xff9f = Delete”
This successfully remaps the numpad-delete until a reboot. Yay!
I will have to put this in a script so I can run it before starting Godot up.

TribalTalker | 2022-09-09 19:31

Glad to hear that you got it sorted out! You could add your steps/script as a solution and mark this as solved, and also in the github issue add this as a workaround. If someone will have the same problem, your findings will be beneficial for them too :slight_smile:

aXu_AP | 2022-09-10 07:40

Hello,

there a bug in godot source code related to X11 key mapping, I filled an issue regarding this bug here: Wrong key mapping for XK_KP_Delete key · Issue #86156 · godotengine/godot · GitHub.

Thanks,
Luc