keyd icon indicating copy to clipboard operation
keyd copied to clipboard

Handling iso_level_x_LATCH

Open Ced-C opened this issue 1 year ago • 1 comments

Hello, Following my comment in this issue, I am trying to get keyd working with my dead key. To recap everything, when I try to use keyd, it works mostly fine for the alpha layers and altGr (iso_level_3_switch), but I have a deak key (let’s call it 1dk) that is technically an iso_level_5_latch (one-shot modifier) to make diacritics like è é à ù ê î û ß ç or typographic characters like or « —», « – ». This key is located on the [N] position on a QWERTY layout.

With keyd, AltGr functions normally, as expected. The 1dk also works, except —as far as tested— if a key has an overloadt. This prevents me from having mod-taps or layer-taps on some keys like [sdf] or space, which are of course the most convenient.

A workaround was proposed, but I either did not understand it correctly, or it did not work. I tried two things :

  • setting up a virtual layer identical key
n = oneshotm(dk)

[dk]
e = e
a = a
  • making a one-shot layer to overide the 1dk
n = oneshot(dk)
[dk]
e = è
i = é
u = ù
  = ’

But I think I do not know how to call this dead key since it has no output…

I hope the issue is clear and the title explicit ; I am no developper myself, so i can be slow to understand… bear with me.

PS : not sure this is needed, but here is my layout : the ** key is the iso_level_5_latch aka 1dk

how to read

┆ 2  6 ┃
┆ 1  5 ┃

1 : level 1 / normal 
2 : level 2 / shift
5 : level 5 / iso_level_5 
6 : level 6 / iso_level_5 shift  

base: |
  ╭╌╌╌╌╌┰─────┬─────┬─────┬─────┬─────┰─────┬─────┬─────┬─────┬─────┰╌╌╌╌╌┬╌╌╌╌╌╮
  ┆ ¬   ┃ # ¡ │ « “ │ » ” │ ( „ │ )   ┃ @   │ + ÷ │ ^*ˇ │ / | │ * × ┃*µ   ┆ § ¶ ┆
  ┆ ~*~ ┃ 1 # │ 2 < │ 3 > │ 4 ( │ 5 ) ┃ 6 @ │ 7 ± │ 8*^ │ 9 \ │ 0 ° ┃ = ≠ ┆ % ‰ ┆
  ╰╌╌╌╌╌╂─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┼╌╌╌╌╌┤
  ·     ┃ B   │ M   │ P   │ O   │ W   ┃ Z   │ V   │ D   │ L   │ J   ┃ {   ┆ }*¤ ┆
  ·     ┃   â │   û │   î │   ô │   œ ┃     │   ŭ │     │     │     ┃ [   ┆ ] ¢ ┆
  ·     ┠─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┼╌╌╌╌╌┤
  ·     ┃ A   │ U   │ I   │ E   │ ; Ê ┃ C   │ T   │ S   │ R   │ N   ┃ "   ┆ & £ ┆
  ·     ┃   à │   ù │   é │   è │ , ê ┃   ç │   ™ │   ß │   ® │   ñ ┃ ' ` ┆ $ € ┆
  ╭╌╌╌╌╌╂─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┴╌╌╌╌╌╯
  ┆ \ ¦ ┃ ! – │ Y   │ X   │ : · │ K   ┃ ? ¿ │ Q   │ G   │ H   │ F   ┃           ·
  ┆ / | ┃ - — │   ŷ │   _ │ . … │   æ ┃***¨ │     │   µ │   © │     ┃           ·
  ╰╌╌╌╌╌┸─────┴─────┴─────┴─────┴─────┸─────┴─────┴─────┴─────┴─────┚ · · · · · ·

altgr: |
  ╭╌╌╌╌╌┰─────┬─────┬─────┬─────┬─────┰─────┬─────┬─────┬─────┬─────┰╌╌╌╌╌┬╌╌╌╌╌╮
  ┆     ┃   ¹ │   ² │   ³ │   ⁴ │   ⁵ ┃   ⁶ │   ⁷ │   ⁸ │   ⁹ │   ⁰ ┃     ┆     ┆
  ┆   ₍ ┃   ₁ │   ₂ │   ₃ │   ₄ │   ₅ ┃   ₆ │   ₇ │   ₈ │   ₉ │   ₀ ┃   ₎ ┆     ┆
  ╰╌╌╌╌╌╂─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┼╌╌╌╌╌┤
  ·     ┃     │   ≤ │   ≥ │  *¤ │   ‰ ┃  *^ │  *µ │   × │  *´ │  *` ┃     ┆     ┆
  ·     ┃   @ │   < │   > │   $ │   % ┃   ^ │   & │   * │   ' │   ` ┃     ┆     ┆
  ·     ┠─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┼╌╌╌╌╌┤
  ·     ┃     │   ⁽ │   ⁾ │     │   ≠ ┃  */ │   ± │   — │   ÷ │  *¨ ┃*ˇ   ┆  *¤ ┆
  ·     ┃   { │   ( │   ) │   } │   = ┃   \ │   + │   - │   / │   " ┃     ┆  ¤  ┆
  ╭╌╌╌╌╌╂─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┴╌╌╌╌╌╯
  ┆     ┃  *~ │     │     │   – │     ┃   ¦ │   ¬ │  *¸ │     │     ┃           ·
  ┆     ┃   ~ │   [ │   ] │   _ │   # ┃   | │   ! │   ; │   : │   ? ┃           ·
  ╰╌╌╌╌╌┸─────┴─────┴─────┴─────┴─────┸─────┴─────┴─────┴─────┴─────┚ · · · · · ·


spacebar:
  shift:       "\u202f"  # NARROW NO-BREAK SPACE
  altgr:       "\u0020"  # SPACE
  altgr_shift: "\u00a0"  # NO-BREAK SPACE
  1dk:         "\u2019"  # RIGHT SINGLE QUOTATION MARK
  1dk_shift:   "\u2018"  # Left SINGLE QUOTATION MARK
``

Ced-C avatar Jan 23 '24 18:01 Ced-C

I am no developper myself, so i can be slow to understand… bear with me.

No worries at all!

This key is located on the [N] position on a QWERTY layout.

I didn't get this the first time - so it is actually not AltGr that latches Level5, but the N key?

The important thing to remember here is that there are many points at which you can modify the behaviour of your keyboard. Keyd works at a rather low level --- it captures your keypresses and presents them through a 'new' virtual keyboard --- but you can also reinterpret keys at the display server level (this is where the ISO_Level_X keys reside) or at the application level.

It sounds like you've changed the interpretation of keys at the display server level and also wish do so some remapping on keyd's level, which gets confusing fast, but it can probably be done. However, if it's possible to do everything on the same level, I do recommend that instead! Perhaps you don't need keyd.

I suggested the following strategy in the linked issue:

[main]
n = oneshotm(dk, n)

[dk]
e = e
a = a

That is, n will still emit n (because that is needed for the display server to engage the ISO_Level5_Latch), but it will also (for the next keypress) enter a layer in which e and a are not overloaded.

I think that should work (at least in your base layer; it would need some refinement elsewhere), but it was based on a guess of how your config is set up. If it doesn't work, can you tell me what you've used to set up the dead key; what your keyd config is; what the output of keyd monitor is when you try to use your 1dk with keyd; and also what the output of keyd monitor is when you use it without keyd running?


As an aside, the oneshotm(dk) in your attempted configs isn't a valid binding, because it's missing a macro as the second argument. e = è et al are valid bindings, but do require that you've set up the compose key as detailed in the manual. = ’ is not a valid binding; you probably mean space = ’

nsbgn avatar Jan 29 '24 12:01 nsbgn

Closing due to inactivity.

rvaiya avatar May 03 '24 22:05 rvaiya