tools: add zsh completions
N.B. To try it out place the completion script called "_xkbcli" somewhere in your $fpath.
Please check that the meson bits are reasonable.
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?
Added some PoC RMLVO completers in the second commit, using yq.
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.
Should be better now, and added more sed implementations.
@wismill any thoughts?