Help me customize keyboard for Spanish language


I don't understand what I see here. I just heard the word funkey monkey a thousand times in the forums but I totally ignore its purpose.
The physical hardware are several separed devices :
- left nub is one joystick (having no buttons, no giro, no rumble, only 2 analog axis)
- right nub is an other distinct joystick
- the gaming buttons (shoulders, d-pad... everything around the d-pad) form a keyboard
- the letters keys (including [fn]) is also a keyboard
- the rumble pack is yet an other joysick, with no button nor axis
funkeymonkey with its pyrainput plugin grab and merge all these physical devices to create 3 virtual device, the OS use in the end :
- a full featured keyboard
- a mouse
- a full featured joystick

Is the layout hardcoded in this funkey monkey and can only be changed at compilation time?
yes and no...
You have to understand how keyboard and key-mapping work. Physically the key just next to the tab key on a french keyboard (a) and a german (q) both produce the same "opcode". It's the keyboad mapping that makes it either an "a" or a "q".
The keyboard pyra-input provide "opcodes" for each keypress (or [fn] combo).
So yes the opcode are completly hardcoded, but the mapping is still configurable at will... just like with a regular keyboard.

For most keys, pyra-input is just a passthrow to limit induced latency to the bare minimum, but since [fn] is a key and not a special modifier like it is on laptop keyboard, pyra-input simulate this behaviour.
And for most key, the combinaison [fn]+key is either drawn on the keyboard or documented on the boards somewhere. so these combinaison produce the op-code related to these keys. But some are not. For these I had to get creative because all the pyra keys + all the possible [fn]+key produce way over 104 keys a normal keyboard produce. Hence [fn]+[e] will produce the op-code for the [setup] key some multimedia keyboard do provide, or [fn]+[r] will generate the opcode for [delete-fle] some weird keyboard do have. and so on. Now that you know how to read that block of code, get back to it, it will looks way clearer :p

I was suggesting to remap these special corner case for your needs : no features lost and you get the glyph (what is drawn on screen, aka opcode+mapping) you want ;)
 
Thank you, @sebt3 Then I guess one could try to xmodmap this, but I'd have to try what's confortable for me

Code:
!Assuming https://dev.pyra-handheld.com/packages/funkeymonkey-pyrainput/-/blob/master/pyrainput.cpp
! refers to constants in /usr/include/linux/input-event-codes.h

! 3rd and 4th positions could theoretically work,
! but they'd require respectively 3 or 4 fingers at once or something, so unlikely

! dead_macron is short straight overline on next char, no French politics/crimes here
!  USR:   KEY_PAUSE   -> ñ  / Ñ
keycode 119 = ntilde Ntilde     dead_tilde dead_macron

!   FN + USER: KEY_SCALE -> · (middot) / diaeresis (dead)
keycode 120 = periodcentered dead_abovering     dead_belowdot dead_abovedot

! FN + N : KEY_GRAVE -> ` (dead)  / ^ (dead)
keycode 41 = dead_grave dead_circumflex     dead_breve dead_caron

! FN + M : 195 -> ´ (dead) / diaeresis (dead)
keycode 195 = dead_acute dead_diaeresis     dead_hook dead_horn

! FN + Y : KEY_ISO -> ¡ / ¿
keycode 170 = exclamdown questiondown    dead_ogonek dead_cedilla
 
Last edited:
But using shift + FN + M to get a dead diaeresis and then still the "u" or "i" might be slow.

I wonder if an option could be to put in .XCompose
Code:
<dead_grave> <i> : "ï"
<dead_grave> <u> : "ü"

Since Catalan does not need ì or ù and diaeresis require 3 keys, but grave requires 2.
That'd be practical but counterintuitive.

Alternatively one could xmodmap ö to dead_diaeresis, like

Code:
! FN + K : F19 -> ¨ (dead) / ´´ (dead)
keycode 189 = dead_diaeresis dead_doubleacute    odiaeresis Odiaeresis

or just reverse the ¨ and ^ in key I so that you get dead ¨ with FN+I and dead ^ with shift+FN+I

Code:
! FN + I : EDIT -> ¨ (dead) / ^ (dead)
keycode 176 = dead_diaeresis dead_circumflex    dead_doubleacute dead_caron
 
So if I understand it correctly, the opcode is the physical key, and in pyra every input/input combination is translated to an opcode existing in a real keyboard and then mapped to a character/behavior.

But I don't know what are the opcodes and physical keys are in the pyrainput.cpp file.

For instance I see:
Code:
global.behaviors->altmap(KEY_TAB,    &global.Fn.pressed, KEY_TAB,    KEY_CAPSLOCK);

In the example KEY_TAB is what you call opcode or it is the arbitrary name for a key in the Pyra keyboard.

Or going back to my use case:

Code:
global.behaviors->altmap(KEY_N,        &global.Fn.pressed, KEY_N,    KEY_GRAVE);
global.behaviors->altmap(KEY_M,        &global.Fn.pressed, KEY_M,    195);

Ok the lines clearly stat that FN + KEY_N writes KEY_GRAVE, bur what does mean 195? And how do I know which options I can use to replace those parameters.

Also where is the KEY_USR1 in that file?

Thanks for the help, is interesting knowing how this works under the hood.
 
On my pyra, xev says when pressing [fn]+[n]:
Code:
KeyPress event, serial 38, synthetic NO, window 0x2c00001,
    root 0x3af, subw 0x0, time 22506832, (-466,100), root:(612,154),
    state 0x0, keycode 49 (keysym 0x60, grave), same_screen YES,
XLookupString gives 1 bytes: (60) "`"
    XmbLookupString gives 1 bytes: (60) "`"
    XFilterEvent returns: False
And when pressing [fn]+[m]:
Code:
KeyPress event, serial 38, synthetic NO, window 0x2c00001,
    root 0x3af, subw 0x0, time 22677321, (-466,100), root:(612,154),
    state 0x0, keycode 203 (keysym 0xb4, acute), same_screen YES,
    XLookupString gives 2 bytes: (c2 b4) "´"
    XmbLookupString gives 2 bytes: (c2 b4) "´"

Both provide the expected glyph (either "`" or "´") as per keymap on the pyra keyboard.

Here the mapping used: https://dev.pyra-handheld.com/packages/pyra-config/-/blob/master/xorg/symbols/pyra
 
Sorry but I don't understand what you try to add with that answer. I can see the character written by fn+m fn+n.

What is the purpose of the symbols file? When it does apply? What configuration have preference (pyrainput.cpp or that symbols file)? Again the Usr key is not present in that file.

By the way the compose key does not work with the default configuration in my system it only does a left click. Is this expected or a bug.
 
The confusing part is the keycode 195, the comment of that line mentions MDSW (modeswitch?), which obviously does not match the actual keyboard layout. The value should be something like KEY_ACUTE instead of a random keycode that seems to be unused officially.
 
Today I tried editing the file pyra within /usr/share/X11/xkb/symbols# but it does not have any effect either.
 
I've been wrong so many times (specially in this thread) that I guess one more doesn't matter. Taking into account that sebt3 reports reading a couple of keycodes 8 units higher than I thought, maybe try this in your xmodmap file and run xmodmap xmodmap_file

Code:
!  USR:   KEY_PAUSE   -> ñ  / Ñ
keycode 127 = ntilde Ntilde     dead_tilde dead_macron

!   FN + USER: KEY_SCALE -> · (middot) / diaeresis (dead)
keycode 128 = periodcentered dead_abovering     dead_belowdot dead_abovedot

! FN + N : KEY_GRAVE -> ` (dead)  / ^ (dead)
keycode 49 = dead_grave dead_circumflex     dead_breve dead_caron

! FN + M : 195 -> ´ (dead) / diaeresis (dead)
keycode 203 = dead_acute dead_diaeresis     dead_hook dead_horn

! FN + Y : KEY_ISO -> ¡ / ¿
keycode 178 = exclamdown questiondown    dead_ogonek dead_cedilla

! FN + K : F19 -> ¨ (dead) / ´´ (dead)
keycode 197 = dead_diaeresis dead_doubleacute    odiaeresis Odiaeresis

! FN + I : EDIT -> ¨ (dead) / ^ (dead)
keycode 184 = dead_diaeresis dead_circumflex    dead_doubleacute dead_caron

But it doesn't have to work. I don't understand what mapping goes between constants in /usr/include/linux/input-event-codes.h and actual xev keycodes. It doesn't have to be always KEY+8.
 
But it doesn't have to work. I don't understand what mapping goes between constants in /usr/include/linux/input-event-codes.h and actual xev keycodes. It doesn't have to be always KEY+8.
It works!

Thanks a lot. That layout just as you wrote works perfectly for me. Really, I'm more happy than I can show here, this is something I almost had given up, and you found the solution.
 
Yes I mean @pyrat answer. I confirm it works

Code:
!  USR:   KEY_PAUSE   -> ñ  / Ñ
keycode 127 = ntilde Ntilde     dead_tilde dead_macron

!   FN + USER: KEY_SCALE -> · (middot) / diaeresis (dead)
keycode 128 = periodcentered dead_abovering     dead_belowdot dead_abovedot

! FN + N : KEY_GRAVE -> ` (dead)  / ^ (dead)
keycode 49 = dead_grave dead_circumflex     dead_breve dead_caron

! FN + M : 195 -> ´ (dead) / diaeresis (dead)
keycode 203 = dead_acute dead_diaeresis     dead_hook dead_horn

! FN + Y : KEY_ISO -> ¡ / ¿
keycode 178 = exclamdown questiondown    dead_ogonek dead_cedilla

! FN + K : F19 -> ¨ (dead) / ´´ (dead)
keycode 197 = dead_diaeresis dead_doubleacute    odiaeresis Odiaeresis

! FN + I : EDIT -> ¨ (dead) / ^ (dead)
keycode 184 = dead_diaeresis dead_circumflex    dead_doubleacute dead_caron
 
Back
Top