Improve Set Keyboard and Locale

This commit is contained in:
MatMoul 2019-01-01 20:30:38 +01:00
parent 4106edbb24
commit dd42259081

12
archfi
View file

@ -901,10 +901,14 @@ archsetkeymap(){
#done #done
items=$(find /usr/share/kbd/keymaps/ -type f -printf "%f\n" | sort -V) items=$(find /usr/share/kbd/keymaps/ -type f -printf "%f\n" | sort -V)
options=() options=()
defsel=""
for item in $items; do for item in $items; do
if [ "${item%%.*}" == "$keymap" ]; then
defsel="${item%%.*}"
fi
options+=("${item%%.*}" "") options+=("${item%%.*}" "")
done done
keymap=$(whiptail --backtitle "$apptitle" --title "$txtsetkeymap" --menu "" 0 0 0 \ keymap=$(whiptail --backtitle "$apptitle" --title "$txtsetkeymap" --menu "" --default-item "$defsel" 0 0 0 \
"${options[@]}" \ "${options[@]}" \
3>&1 1>&2 2>&3) 3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then if [ "$?" = "0" ]; then
@ -936,10 +940,14 @@ archsetfont(){
archsetlocale(){ archsetlocale(){
items=$(ls /usr/share/i18n/locales) items=$(ls /usr/share/i18n/locales)
options=() options=()
defsel=""
for item in $items; do for item in $items; do
if [ "$defsel" == "" ]&&[ "${keymap::2}" == "${item::2}" ]; then
defsel="$item"
fi
options+=("$item" "") options+=("$item" "")
done done
locale=$(whiptail --backtitle "$apptitle" --title "$txtsetlocale" --menu "" 0 0 0 \ locale=$(whiptail --backtitle "$apptitle" --title "$txtsetlocale" --menu "" --default-item "$defsel" 0 0 0 \
"${options[@]}" \ "${options[@]}" \
3>&1 1>&2 2>&3) 3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then if [ "$?" = "0" ]; then