Not all Numpad keys works with Plug-In CustomCommandsMenu
Describe the bug
Numpad keys /, *, -, + and Enter, doesn't work when CustomCommandsMenu plug-in is enabled.
To Reproduce
Just checkbox CustomCommandsMenu plug-in in settings and try to use numpad keys listed above.
Desktop:
- Linux Debian Trixie (Testing)
- Terminator 2.1.4
- Display Technology: X11
I have the same problem.
Desktop:
Linux Fedora 40 Desktop Terminator 2.1.4 Display Technology: Wayland
I had the same issue, and thanks to this issue I figured out it was the CustomCommandsMenu plugin. for me, the only key that isn't working is the Enter (Numpad)
I managed to fix it, but I'll show you the process I did with ChatGPT so you can also test out other keys that isn't working.
The issue happened because the CustomCommandsMenu plugin intercepts all key presses, so it is preventing certain keys from reaching the terminal.
Debugging Process
- Looking for the default plugins folder path
locate -i terminator
in my case, terminator was installed using apt install terminator on kali (debian) box, so the path is:
/usr/lib/python3/dist-packages/terminatorlib/plugins/
- Open
custom_commands.pywith text editor and look for theon_keypressfunction (line 156) - Let's add a simple
print()to print any key pressed, on the very first line:
print(f"Key pressed: keyval={event.keyval}, state={event.state}")
- Run
terminatorand press the key that isn't working for you. Here I'm pressingEnterkey 4 times IMPORTANT: openterminatorfrom another terminal in order to see the print's. i opened it from QTerminal
Solution
Modifying the on_keypress method to explicitly ignore keyval=65421 by returning False when this key is detected.
if event.keyval == 65421:
return False
@DrorDvash, you are such a genius!!! This fixed the issue for me.
Debian testing / Trixie: /usr/lib/python3/dist-packages/terminatorlib/plugins/custom_commands.py:
def on_keypress(self, widget, event):
# DEBUG: print raw keyval
#print(f"Key pressed: keyval={event.keyval}, state={event.state}")
# END DEBUG
bugged_keys = (65421, 65450, 65451, 65453, 65455) # NumPad: ENTER, *, + , -, /
if event.keyval in bugged_keys:
return False
Recently Debian updated Terminator and I needed to apply those changes again. So I made a script:
#!/bin/zsh
clear
file="/usr/lib/python3/dist-packages/terminatorlib/plugins/custom_commands.py"
target="def on_keypress(self, widget, event):"
echo -e "\e[93mBefore:\e[0m"
grep -n -A7 $target $file
line=$(grep -n $target $file | cut -d' ' -f1 | sed 's/://')
line=$(( $line + 1 ))
sed -i "${line}i\ # NumPad fix: ENTER, *, + , -, /\n bugged_keys = (65421, 65450, 65451, 65453, 65455)\n if event.keyval in bugged_keys:\n return False\n" $file
echo -e "\n\e[93mAfter:\e[0m"
grep -n -A11 $target $file
Replace #!/bin/zsh by whatever shell you use.
I tried first with head -156 $file + insert lines + tail +157 $file but apparently head and tail do not respect literal \n and this changed some things within the script that should not have been changed.
This script works.
Should be an easy fix. Once I'm done triaging