Scala Peritus
Scala Peritus

Reputation: 11

Programatically configure a keyboard in Ubuntu 22.04

I'm working with Ubuntu 22.04 and I've created a custom keyboard. I'm using Ansible to provision the machine and I've placed the custom keyboard mapping file under /usr/share/X11/xkb/symbols/tss_kiosk

I have a customized evdev.xml file with the following contents that is placed under /usr/share/X11/xkb/rules/evdev.xml:

  <configItem>
        <name>tss_kiosk</name>
        <!-- Keyboard indicator for English layouts -->
        <shortDescription>tss_kiosk</shortDescription>
        <description>tss_kiosk</description>
        <languageList>
          <iso639Id>eng</iso639Id>
        </languageList>
      </configItem>

If I use the UI to configure the Keyboard layout, in the input sources under settings. I can see when I go to add a new one, it shows up under the listing for English (United States) and if I select it and remove the default English(US) laoyt that my keyboard bindings work. My question is how can I set this programatically to select that tss_kiosk as the default keyboard during provisioning after I've placed the files on the machine.

I've tried configuring the /etc/default/keyboard file also so that it looks like the following:

# KEYBOARD CONFIGURATION FILE

# Consult the keyboard(5) manual page.

XKBMODEL="pc105"
XKBLAYOUT="tss_kiosk"
XKBVARIANT=""
XKBOPTIONS=""

BACKSPACE="guess"

This did not seem to affect anything either.

I managed to set the keyboard layout programatically using

gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'tss_kiosk')]"

and that would work, however when I started up the os using Ubuntu Frame and starting the Firefox browser in the frame, the settings did not take.

My expectation was that I would boot up and the correct keymapping would be applied.

Upvotes: 0

Views: 243

Answers (0)

Related Questions