2015-08-20 14:37:06 -06:00
|
|
|
#!/bin/bash
|
|
|
|
. ./lib
|
|
|
|
|
2018-10-02 12:28:48 -06:00
|
|
|
pacman -Q libxkbcommon 2> /dev/null
|
|
|
|
if [ "$?" = "1" ]; then
|
|
|
|
if(confirm "libxkbcommon is required to use localectl.\nInstall libxkbcommon ?") then
|
|
|
|
instpkg "libxkbcommon" ""
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2015-08-20 14:37:06 -06:00
|
|
|
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
|