From dd42259081b60897dbe97856f120c60c67cfbfd3 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Tue, 1 Jan 2019 20:30:38 +0100 Subject: [PATCH] Improve Set Keyboard and Locale --- archfi | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/archfi b/archfi index 4240970..0c5c039 100644 --- a/archfi +++ b/archfi @@ -901,10 +901,14 @@ archsetkeymap(){ #done items=$(find /usr/share/kbd/keymaps/ -type f -printf "%f\n" | sort -V) options=() + defsel="" for item in $items; do + if [ "${item%%.*}" == "$keymap" ]; then + defsel="${item%%.*}" + fi options+=("${item%%.*}" "") 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[@]}" \ 3>&1 1>&2 2>&3) if [ "$?" = "0" ]; then @@ -936,10 +940,14 @@ archsetfont(){ archsetlocale(){ items=$(ls /usr/share/i18n/locales) options=() + defsel="" for item in $items; do + if [ "$defsel" == "" ]&&[ "${keymap::2}" == "${item::2}" ]; then + defsel="$item" + fi options+=("$item" "") 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[@]}" \ 3>&1 1>&2 2>&3) if [ "$?" = "0" ]; then