Skip to content

Conversation

@rpigott
Copy link
Contributor

@rpigott rpigott commented Oct 28, 2025

N.B. To try it out place the completion script called "_xkbcli" somewhere in your $fpath.

Please check that the meson bits are reasonable.

@rpigott
Copy link
Contributor Author

rpigott commented Oct 28, 2025

I like to provide completions for the layouts/models/options, etc. but not sure there's a good way without parsing xkbcli output with yq or something. I don't particularly mind doing that, but obviously its better if we don't depend on an external tool.

Do you think it would be possible to give xkbcli a more shell-parse friendly output?

@rpigott
Copy link
Contributor Author

rpigott commented Oct 28, 2025

Added some PoC RMLVO completers in the second commit, using yq.

Copy link
Member

@wismill wismill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great addition! Thanks!

@rpigott rpigott force-pushed the zsh-completion branch 2 times, most recently from 91e59af to 8b8667c Compare October 30, 2025 09:09
@rpigott
Copy link
Contributor Author

rpigott commented Oct 30, 2025

The options RMLVO completer isn't working perfectly, as the group names don't always match the options prefixes:

$ XKB_DEFAULT_OPTIONS=<TAB>
altwin        -- Alt and Win behavior
caps          -- Caps Lock behavior
compat        -- Compatibility options
compose       -- Position of Compose key
ctrl          -- Ctrl position
currencysign  -- Currency signs
custom        -- Miscellaneous options
esperanto     -- Esperanto letters with superscripts
fkeys         -- Function keys
grp_led       -- Use keyboard LED to show alternative layout
grp           -- Switching to another layout
japan         -- Japanese keyboard options
keypad        -- Layout of numeric keypad
korean        -- Korean Hangul/Hanja keys
kpdl          -- Numeric keypad Delete behavior
lv2           -- Key to choose the 2nd level
lv3           -- Key to choose the 3rd level
lv5           -- Key to choose the 5th level
mod_led       -- Use keyboard LED to indicate modifiers
nbsp          -- Non-breaking space input
solaris       -- Old Solaris keycodes compatibility
terminate     -- Key sequence to kill the X server

$ XKB_DEFAULT_OPTIONS=compat:<TAB> # these aren't real options since they don't actually being with "compat:"
alupckeys             -- Apple Aluminium emulates Pause, PrtSc, Scroll Lock
apl                   -- Enable APL overlay characters
both_capslock         -- Both Shifts together enable Caps Lock
both_capslock_cancel  -- Both Shifts together enable Caps Lock; one Shift key disables it
both_shiftlock        -- Both Shifts together enable Shift Lock
break_actions         -- Allow breaking grabs with keyboard actions (warning: security risk)
breaks_caps           -- Shift cancels Caps Lock
debug                 -- Allow grab and window tree logging
jp_oadg109a           -- Japanese Apple keyboards emulate OADG109A backslash
jp_pc106              -- Japanese Apple keyboards emulate PC106 backslash
mac                   -- Numeric keypad always enters digits (as in macOS)
microsoft             -- Num Lock on: digits; Shift for arrows. Num Lock off: arrows (as in Windows)
mod2                  -- Map Hyper to Mod2 (conflict with NumLock)
mod3                  -- Map Hyper to Mod3 (conflict with LevelFive)
mod4                  -- Map Hyper to Mod4 (conflict with Super)
none                  -- Special keys (Ctrl+Alt+<key>) handled in a server
pc                    -- Default numeric keypad keys
pointerkeys           -- Shift + Num Lock enables PointerKeys
shift3                -- Shift does not cancel Num Lock, chooses 3rd level instead
typo                  -- Enable extra typographic characters

I'll think of a better way to present these completions.

@rpigott rpigott marked this pull request as draft October 30, 2025 19:16
@rpigott
Copy link
Contributor Author

rpigott commented Oct 30, 2025

Should be better now, and added more sed implementations.

@rpigott rpigott marked this pull request as ready for review October 30, 2025 23:08
To spare parsing yaml output in zsh code, these completers rely on yq to parse
the xkbcli output.

If yq is not installed, the completion will fallback to a more rudimentary
version using only sed for parsing.
@rpigott
Copy link
Contributor Author

rpigott commented Dec 6, 2025

@wismill any thoughts?

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.

2 participants