#!/bin/sh

set -eu

# Get $TAILS_XKBMODEL, $TAILS_XKBLAYOUT, $TAILS_XKBVARIANT and $TAILS_XKBOPTIONS
. /var/lib/tails-user-session/keyboard

dconf write /org/gnome/libgnomekbd/keyboard/model   "'$XKBMODEL'"
dconf write /org/gnome/libgnomekbd/keyboard/layouts "['$XKBLAYOUT\\t$XKBVARIANT']"
if [ "$XKBLAYOUT" != "us" ]; then
  # Add 'us' switch. Note that it's important that we set the layout
  # on its own above, because otherwise the following will make 'us'
  # the default.
  dconf write /org/gnome/libgnomekbd/keyboard/layouts "['$XKBLAYOUT\\t$XKBVARIANT', 'us']"
fi


syntax highlighted by Code2HTML, v. 0.9.1