Setxkbmap – List All Valid Keyboard Layouts, Variants, and Toggle Options

keyboardkeyboard-layoutxkbxorg

Is there a way from command line to retrieve the list of all available
keyboard layouts and relative variants?

I need to list all the valid layout/variants choices to be used then from setxkbmap.

Also about the layout toggle options, is there a way to retrieve a list of all available choices (e.g. grp:shift_caps_toggle , …)

I know that with

setxkbmap -query

I retrieve the list of my current ones, but I need the whole list of options.

UPDATE:

I've been told about the command

man xkeyboard-config

which provides all the info to the command line.

Furthermore, using

man -P cat xkeyboard-config

the output goes to stdout and can be parsed with scripts or c code

Best Answer

Try looking in /usr/share/X11/xkb/symbols as described on the setxkbmap man page. The options can be found in various files, try doing a grep -rinH alts_toggle /usr/share/X11/xkb. /usr/share/X11/xkb/rules/xorg.xml looks like a good choice.