Skip to content

Handle unique edge case offered by '-option numpad:mac'#510

Open
jordansissel wants to merge 1 commit intomainfrom
issue/507
Open

Handle unique edge case offered by '-option numpad:mac'#510
jordansissel wants to merge 1 commit intomainfrom
issue/507

Conversation

@jordansissel
Copy link
Owner

New test added. Typing tests pass.

In this case, the KEYPAD type deletes(?) its Level 1 by setting
map[None] = 2 and level_name[2] = "Number" which appears to make
level_name[1] null.

The weird edge case here is that "no modifiers" is mapped to a
non-level-1 shift level. And further, that the level entry seems to just be deleted in the keymap, no name, no atom, etc.

I confirmed this causes keypad keys to have their
key_type->level_names[0] == 0.

So now, levels with level_names[level] == 0 are skipped.

I also tried rewriting the keymap scanning code to be a little cleaner?
I removed the 'li == 0' shortcut because in this specific case, li==0 ("shift level
1") doesn't actually have any mappings and causes xdo to error when
trying to look up the level name! It's null! It has no name!

Fixes #507

New test added. Typing tests pass.

In this case, the KEYPAD type deletes(?) its Level 1 by setting
`map[None] = 2` and `level_name[2] = "Number"` which appears to make
level_name[1] null.

The weird edge case here is that "no modifiersh" is mapped to a
non-level-1 shift level.

I confirmed this causes keypad keys to have their
key_type->level_names[0] == 0.

So now, levels with level_names[level] == 0 are skipped.

I also tried rewriting the keymap scanning code to be a little cleaner?
I removed the 'li == 0' shortcut because in this specific case, li==0 ("shift level
1") doesn't actually have any mappings and causes xdo to error when
trying to look up the level name! It's null! It has no name!

Fixes #507
@jordansissel
Copy link
Owner Author

Since this PR changes how the keymap is processed, it's entirely possible that this fixes #507 while breaking something else.

@dorsiflexion
Copy link

dorsiflexion commented Mar 7, 2026

Can confirm the fix. I tried a few commands and didn't find any breakage so far.

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

Successfully merging this pull request may close these issues.

setxkbmap option numpad:mac breaks xdotool since v4.20251130.1

2 participants