Skip to main content

parse_keymap

Function parse_keymap 

Source
pub fn parse_keymap(keymap: &str) -> Keymap
Expand description

Parses a keymap.

The returned keymap can later be used to set the keymap of a seat. If the keymap cannot be parsed, returns an invalid keymap. Trying to set a seat’s keymap to an invalid keymap has no effect.

A simple keymap looks as follows:

xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)" };
    xkb_types     { include "complete" };
    xkb_compat    { include "complete" };
    xkb_symbols   { include "pc+inet(evdev)+us(basic)" };
};

To use a programmer Dvorak, replace the corresponding line by

    xkb_symbols   { include "pc+inet(evdev)+us(dvp)" };

To use a German keymap, replace the corresponding line by

    xkb_symbols   { include "pc+inet(evdev)+de(basic)" };

You can also use a completely custom keymap that doesn’t use any includes. See the default Jay keymap for an example.

General information about the keymap format can be found in the arch wiki.

See also Keymap::builder for a more general interface.