Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some specific keymappings do not work #171

Closed
giatmanos opened this issue Aug 28, 2024 · 9 comments
Closed

Some specific keymappings do not work #171

giatmanos opened this issue Aug 28, 2024 · 9 comments

Comments

@giatmanos
Copy link

I have a relatively simple keymapping config where I have mapped Alt to Shift and AltGr to Control:

# define some aliases
Alt         = AltLeft
AltGr       = AltRight
Win         = Meta

# immediately forward common modifier keys
IntlBackslash   >> Escape
CapsLock >> Tab
Tab     >> Delete
Control >> AltLeft
AltLeft >> Shift
AltRight >> Control

# Arrow keys mappings
Shift{J} >> ArrowDown
Shift{K} >> ArrowUp
Shift{H} >> ArrowLeft
Shift{L} >> ArrowRight

# Linux specifix workspace movement keys
Meta{ArrowLeft} >> Control{Meta{ArrowLeft}}
Meta{ArrowRight} >> Control{Meta{ArrowRight}}

# Numbers
Shift{Q} >> 1
Shift{W} >> 2
Shift{E} >> 3
Shift{R} >> 4
Shift{T} >> 5
Shift{Y} >> 6
Shift{U} >> 7
Shift{I} >> 8
Shift{O} >> 9
Shift{P} >> 0

The problem is that when I go to a keyboard tester and also throughout on my machine, Control + Shift + T or Control + Shift + V do not work. They simply do not register the T and V. All the other combinations with other letters work fine.

I am on a linux machine.

@ristomatti
Copy link
Contributor

Control + Shift + T or Control + Shift + V do not work

  1. When pressing the mapped or the actual keys?
  2. What would you expect it to output (e.g. Control+Shift+T or AltLeft+Shift+T)?

I tested the config a bit. Did you notice that then pressing Control{Shift{T}} it outputs AltLeft{Shift{T}} (Alt + %)?

If you modify the second block of mappings to this, does it then do what you'd expect:

Control >> AltLeft
AltLeft >> Shift
AltRight >> Control

# You likely want to forward Shift as well
Shift >> Shift

# Control+Shift+QWERTYUIOP is sent as is
TopRow = Q | W | E | R | T | Y | U | I | O | P
(Control Shift TopRow) >> !AltLeft (Control Shift TopRow)

@ristomatti
Copy link
Contributor

Couple of tools to test mappings you might have not tried:

  1. Command xev filtered to only print the relevant lines:

    xev -rv -event keyboard -event button | grep -E "(KeyPress|KeyRelease|state)"
    
  2. Keyboard event viewer that logs the events in a table: https://w3c.github.io/uievents/tools/key-event-viewer.html

@ristomatti
Copy link
Contributor

ristomatti commented Aug 29, 2024

FYI @houmain, the link above might be useful to mention in README.md (or this similar one https://keyevents.netlify.app/).

@ristomatti
Copy link
Contributor

@giatmanos Another thing you could try is remapping the modifiers in an initial stage. This way you could use the mapped key names for the key combinations:

IntlBackslash >> Escape
CapsLock      >> Tab
Tab           >> Delete
Control       >> AltLeft
AltLeft       >> Shift
AltRight      >> Control

[stage]
# immediately forward common modifier keys
Control >> Control
Alt     >> Alt
Shift   >> Shift
Meta    >> Meta

# Arrow keys mappings
Alt{J} >> ArrowDown
Alt{K} >> ArrowUp
Alt{H} >> ArrowLeft
Alt{L} >> ArrowRight

@giatmanos
Copy link
Author

Thanks @ristomatti for all the insights.
The xev app proved very useful and I will keep using it for testing my config.

Just to clarify, what I am trying to achieve with this keymapping config is to:

  • move Shift to my left thumb (AltLeft),
  • move Control to my right thumb (AltRight),
  • move escape closer (my surface laptop has a UK layout and since I am always using a US layout the IntlBackslash key is useless and therefore the perfect candidate),
  • move Tab next to my pinky in the home row and get rid of useless CapsLock,
  • do something with the remaining unassigned Tab key (the distant Delete key is the perfect candidate),
  • do something with the now useless Shift key (use as a layer toggle to bring arrow keys in my home row vim style),
  • remap AltLeft somewhere so that it doesn't feel left out (the blank Control key is the only empty key left)
  • et voila!

This resembles much more closely the layout of my custom keyboard which I feel at home with and therefore I don't need to bring it with my surface device and completely break portability.

So to answer your question directly: I desire to physically press (AltLeft AltRight T) and register it on my machine as (Control Shift T) and equally with V.

With the xev that you shared, when physically pressing (AltLeft AltRight T) I got this output:

KeyPress event, serial 28, synthetic NO, window 0x4200001,
    state 0x10, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
KeyPress event, serial 28, synthetic NO, window 0x4200001,
    state 0x11, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
KeyRelease event, serial 28, synthetic NO, window 0x4200001,
    state 0x15, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
KeyRelease event, serial 28, synthetic NO, window 0x4200001,
    state 0x14, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
KeyPress event, serial 28, synthetic NO, window 0x4200001,
    state 0x10, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
KeyPress event, serial 28, synthetic NO, window 0x4200001,
    state 0x11, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
KeyRelease event, serial 28, synthetic NO, window 0x4200001,
    state 0x15, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
KeyRelease event, serial 28, synthetic NO, window 0x4200001,
    state 0x11, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,

The first KeyRelease events for Control_L and Shift_L indicate the moment I pressed the T key. Upon release of the T key, the KeyPress events for Control_L and Shift_L occurred and when I released the AltLeft and AltRight we get the KeyRelease events as shown.

For comparison, here is a snippet from pressing the same combo but with another letter key, i.e. A:

KeyPress event, serial 28, synthetic NO, window 0x5600001,
    state 0x10, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
KeyPress event, serial 28, synthetic NO, window 0x5600001,
    state 0x11, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
KeyPress event, serial 28, synthetic NO, window 0x5600001,
    state 0x15, keycode 38 (keysym 0x41, A), same_screen YES,
KeyRelease event, serial 28, synthetic NO, window 0x5600001,
    state 0x15, keycode 38 (keysym 0x41, A), same_screen YES,
KeyRelease event, serial 28, synthetic NO, window 0x5600001,
    state 0x15, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
KeyRelease event, serial 28, synthetic NO, window 0x5600001,
    state 0x11, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,

This looks bang on like what I'd expect to happen with T as well but T and V are special apparently!

I haven't tested any of your recommendations yet as I thought I'd shed some more light to the issue before introducing additional testing information. I will experiment more now and report back.

@giatmanos
Copy link
Author

giatmanos commented Aug 29, 2024

Oh, wait a minute! i just thought I'd do the obvious and tested my keyboard without keymapper active. Here are the logged key presses/releases when I press AltLeft AltRight T:

KeyPress event, serial 25, synthetic NO, window 0x5600001,
    state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
KeyPress event, serial 28, synthetic NO, window 0x5600001,
    state 0x18, keycode 108 (keysym 0xffea, Alt_R), same_screen YES,
KeyRelease event, serial 28, synthetic NO, window 0x5600001,
    state 0x18, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
KeyRelease event, serial 28, synthetic NO, window 0x5600001,
    state 0x18, keycode 108 (keysym 0xffea, Alt_R), same_screen YES,
KeyPress event, serial 28, synthetic NO, window 0x5600001,
    state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
KeyPress event, serial 28, synthetic NO, window 0x5600001,
    state 0x18, keycode 108 (keysym 0xffea, Alt_R), same_screen YES,
KeyRelease event, serial 28, synthetic NO, window 0x5600001,
    state 0x18, keycode 108 (keysym 0xffea, Alt_R), same_screen YES,
KeyRelease event, serial 28, synthetic NO, window 0x5600001,
    state 0x18, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,

Wuuuuh?

I tested the same on another laptop with https://keyevents.netlify.app/ and on there it worked fine. I also tested the same on the same surface laptop but with an external keyboard and the issue was no longer there. My guess is that this is a hardcoded key combo for some shortcut that will make me miserable. I will have to map Control + Shift to another key... This is so frustrating!

@giatmanos
Copy link
Author

I will close this ticket as this is specific to Surface Pro typecover keyboards and it is not an issue with keymapper.

@giatmanos giatmanos closed this as not planned Won't fix, can't repro, duplicate, stale Aug 29, 2024
@ristomatti
Copy link
Contributor

My guess would be that it has something to do with how the key matrix on it is arranged. QMK docs has a good page on the topic https://docs.qmk.fm/how_a_matrix_works

@houmain
Copy link
Owner

houmain commented Aug 31, 2024

And here is a nice site for testing which combinations a keyboard supports: https://www.microsoft.com/applied-sciences/projects/anti-ghosting-demo/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants