obosdi-pkg/config/xorg/keyboard

84 lines
1.9 KiB
Text
Raw Normal View History

2015-08-20 14:37:06 -06:00
#!/bin/bash
. ./lib
pacman -Q libxkbcommon 2> /dev/null
if [ "$?" = "1" ]; then
2018-10-02 12:35:25 -06:00
if(confirm "libxkbcommon is required to use localectl.\n\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
2018-10-02 12:35:25 -06:00
clear
2015-08-20 14:37:06 -06:00
localectl set-x11-keymap $layout $model $variant $option
2018-10-02 12:35:25 -06:00
pressanykey
2015-08-20 14:37:06 -06:00
fi
exit 0