fjvallarino/monomer

Problems with binding keystrokes

Closed this issue · 8 comments

I have several questions/problems regarding binding keystrokes:

  • Because '-' has a special meaning for separation of key modifiers, I can't seem to make a binding for it, because the function splits on this character.
  • I have problems with defining keystrokes for other symbols, like ^, +. For +, Shift-= doesn't work unless I bind it specifically. These symbols also don't work at all on the numpad, see next point. Would it be possible to make the keystroke depend on the text it produces?
  • How do I bind numpad keys? Binding number keys works only on the num row, not the numpad. The symbols also don't work.

I just pushed a branch that handles the first two issues:

  • You can use Dash to handle the '-' character. For example, "C-Dash".
  • Symbols can now be handled but, since they are not physical keys, I can't detect when they were released (since they share the keyCode with the main key). Below is the note I added in the widget's Haddock.
Note 3: Symbols that require pressing the Shift key (^, &, etc.) are virtual keys
and share the KeyCode with the symbol associated to the same physical key. This
causes issues when detecting their pressed status, and thus it's not possible to
combine these symbols with letters, numbers, or other symbols in the same
keystroke. It is still possible to combine them with mod keys, so using "C-^" or
"C-[" is possible.

Regarding the Numpad, I'll take a look in the following days to add support for handling the numbers (I don't have a numeric keyboard on my laptop). I wonder if they now work, since the Text event is also being handled.

To test these changes, you need to modify your stack.yaml:

- git: https://github.com/fjvallarino/monomer.git
  commit: 5298dbef95ee50f752298a5fd3f3074196e493dd

Awesome, I'll try these changes out. Thanks

Almost everything works as expected. The numpad also works now, apart from (for whatever reason) the numpad dash key and numpad enter.

I just pushed a new commit that handles '-' as text (previously it was using a KeyCode) and added a new word for the key-pad's Enter, "KpEnter". In both cases the KeyCode was different, and it's the reason why they didn't work (hopefully now they do).

The stack.yaml file should now point to:

- git: https://github.com/fjvallarino/monomer.git
  commit: d52dd81afcd4d00b40373073d4c8cec316b5bd93

Does this also affect the "Fn" key on my notebook? I haven't tried it yet, but in current main branch I receive this output in my console: The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list <https://discourse.libsdl.org/> X11 KeyCode 151 (143), X11 KeySym 0x1008FF2B (XF86WakeUp).

Now everything works properly, thanks!

Does this also affect the "Fn" key on my notebook? I haven't tried it yet, but in current main branch I receive this output in my console: The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list https://discourse.libsdl.org/ X11 KeyCode 151 (143), X11 KeySym 0x1008FF2B (XF86WakeUp).

@prolic No, it's not related. That seems to be an issue on SDL itself, so that keypress never even gets to Monomer.

As this has been merged to main, I'll close the issue. Please re-open or create a new one if needed. Thanks!