How to get the keymap of the currently used keyboard?

72 Views Asked by At

I want to compare the currently active keyboard layout to one specific other keyboard layout.

I can get a keymap of a specific (here Icelandic) keyboard like this:

// get a keymap from a given name ( is)
    struct xkb_rule_names names = {
    // Example RMLVO for Icelandic Dvorak. 
        .rules = NULL,
        .model = "pc105",
        .layout = "is",
        .variant = "dvorak",
        .options = "terminate:ctrl_alt_bksp"
    };
    struct xkb_keymap *keymap_is =
        xkb_keymap_new_from_names(ctx, &names, XKB_KEYMAP_COMPILE_NO_FLAGS);

But I can't get the keymap of my currently used keyboard. What I am looking for is a function I could call like xkb_keymap_new_from_default(), returning a struct xkb_keymap*.

0

There are 0 best solutions below