#!/bin/bash . ./lib options=() items=$(localectl list-x11-keymap-layouts) for item in $items; do options+=("$item" "") done layout=$(whiptail --backtitle "$apptitle" --title "Select keyboard layout :" --menu "" --cancel-button "Cancel" 0 0 0 \ "${options[@]}" \ 3>&1 1>&2 2>&3) if [ ! "$?" = "0" ]; then exit 1 fi options=() options+=("ignore" "") options+=("pc104" "Default") options+=("pc105" "") items=$(localectl list-x11-keymap-models) for item in $items; do options+=("$item" "") done model=$(whiptail --backtitle "$apptitle" --title "Select keyboard model :" --menu "" --cancel-button "Cancel" 0 0 0 \ "${options[@]}" \ 3>&1 1>&2 2>&3) if [ ! "$?" = "0" ]; then exit 1 fi if [ "$model" = "ignore" ]; then model="" fi options=() options+=("ignore" "Default") items=$(localectl list-x11-keymap-variants $layout) for item in $items; do options+=("$item" "") done variant=$(whiptail --backtitle "$apptitle" --title "Select keyboard variant :" --menu "" --cancel-button "Cancel" 0 0 0 \ "${options[@]}" \ 3>&1 1>&2 2>&3) if [ ! "$?" = "0" ]; then exit 1 fi if [ "$variant" = "ignore" ]; then variant="" fi options=() options+=("ignore" "Default") items=$(localectl list-x11-keymap-options) for item in $items; do options+=("$item" "") done option=$(whiptail --backtitle "$apptitle" --title "Select keyboard option :" --menu "" --cancel-button "Cancel" 0 0 0 \ "${options[@]}" \ 3>&1 1>&2 2>&3) if [ ! "$?" = "0" ]; then exit 1 fi if [ "$option" = "ignore" ]; then option="" fi if ( confirm "Run localectl set-x11-keymap $layout $model $variant $option ?") then localectl set-x11-keymap $layout $model $variant $option fi exit 0