Improve keyboard layouts

This commit is contained in:
Augusto Gunsch 2021-08-12 21:03:44 -03:00
parent 4ccacaa8c3
commit 7279cfb91a
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
3 changed files with 85 additions and 12 deletions

View File

@ -31,12 +31,13 @@ ultra_quiet() {
[ $(whoami) != "root" ] && echo "Please run as root" && exit 1 [ $(whoami) != "root" ] && echo "Please run as root" && exit 1
### CD TO MY DIR ### ### CD TO MY DIR ###
cd "$(basename "$0")" cd "$(dirname "$0")"
### URLs ### ### URLs ###
FZF_DOWNLOAD="$(curl -s https://api.github.com/repos/junegunn/fzf/releases/latest | grep linux_amd64 | sed -nE 's/^\s*"browser_download_url":\s*"(.*)"\s*$/\1/p')" FZF_DOWNLOAD="$(curl -s https://api.github.com/repos/junegunn/fzf/releases/latest | grep linux_amd64 | sed -nE 's/^\s*"browser_download_url":\s*"(.*)"\s*$/\1/p')"
PARTED_DOWNLOAD="https://archlinux.org/packages/extra/x86_64/parted/download" PARTED_DOWNLOAD="https://archlinux.org/packages/extra/x86_64/parted/download"
POST_INSTALL_SCRIPT="https://raw.githubusercontent.com/augustogunsch/install-arch/master/post-install.sh" POST_INSTALL_SCRIPT="https://raw.githubusercontent.com/augustogunsch/install-arch/master/post-install.sh"
KEYBOARD_MAP="https://raw.githubusercontent.com/augustogunsch/install-arch/master/keyboard-map.csv"
### COLORS ### ### COLORS ###
RED='\033[0;31m' RED='\033[0;31m'
@ -229,13 +230,22 @@ set_locale() {
echo "done" echo "done"
echo -n "Setting keyboard layout..." echo -n "Setting keyboard layout..."
echo "keymap=\"$XKBD_LAYOUT\"" > /etc/conf.d/keymaps
echo "KEYMAP=\"$KBD_LAYOUT\"" > /etc/vconsole.conf echo "KEYMAP=\"$KBD_LAYOUT\"" > /etc/vconsole.conf
XKBD="$(awk -F: '$1 ~ /^'$KBD_LAYOUT'$/ {print $0; exit 0}' keyboard-map.csv)"
XKBD_LAYOUT="$(echo $XKBD | awk -F: '{print $2}')"
XKBD_MODEL="$(echo $XKBD | awk -F: '{print $3}')"
XKBD_VARIANT="$(echo $XKBD | awk -F: '{print $4}')"
XKBD_OPTIONS="$(echo $XKBD | awk -F: '{print $5}')"
echo "keymap=\"$XKBD_LAYOUT\"" > /etc/conf.d/keymaps
local XKBD_CONF="/etc/X11/xorg.conf.d/00-keyboard.conf" local XKBD_CONF="/etc/X11/xorg.conf.d/00-keyboard.conf"
echo "Section \"InputClass\"" > $XKBD_CONF echo "Section \"InputClass\"" > $XKBD_CONF
echo " Identifier \"system-keyboard\"" >> $XKBD_CONF echo " Identifier \"system-keyboard\"" >> $XKBD_CONF
echo " MatchIsKeyboard \"on\"" >> $XKBD_CONF echo " MatchIsKeyboard \"on\"" >> $XKBD_CONF
echo " Option \"XkbLayout\" \"$XKBD_LAYOUT\"" >> $XKBD_CONF echo " Option \"XkbLayout\" \"$XKBD_LAYOUT\"" >> $XKBD_CONF
echo " Option \"XkbModel\" \"$XKBD_MODEL\"" >> $XKBD_CONF
[ -n $XKBD_VARIANT ] && echo " Option \"XkbVariant\" \"$XKBD_VARIANT\"" >> $XKBD_CONF
[ -n $XKBD_OPTIONS ] && echo " Option \"XkbOptions\" \"$XKBD_OPTIONS\"" >> $XKBD_CONF
echo "EndSection" >> $XKBD_CONF echo "EndSection" >> $XKBD_CONF
echo "done" echo "done"
} }
@ -316,15 +326,9 @@ prompt_all() {
echo "Choose locale:" echo "Choose locale:"
LOCALE=$(sed '/^#\s/D' < /etc/locale.gen | sed '/^#$/D' | sed 's/^#//' | fzf --layout=reverse --height=20) LOCALE=$(sed '/^#\s/D' < /etc/locale.gen | sed '/^#$/D' | sed 's/^#//' | fzf --layout=reverse --height=20)
qpushd /usr/share/kbd/keymaps [ -f keyboard-map.csv ] || curl -sL "$KEYBOARD_MAP" -o keyboard-map.csv
local layouts="$(ls -1 **/*.map.gz | sed -E 's/^(.*)\.map\.gz$/\1/')" echo "Choose keyboard layout:"
qpopd KBD_LAYOUT="$(awk -F: '{print $1}' keyboard-map.csv | fzf --layout=reverse --height=20)"
echo "Choose console keyboard layout:"
KBD_LAYOUT="$(basename $(echo -e "$layouts" | fzf --layout=reverse --height=20))"
echo "Choose X11 keyboard layout:"
XKBD_LAYOUT="$(awk 'BEGIN {toprint=0} $0 ~ /^[[:blank:]]*$/ {toprint=0} $2 ~ /layout/ {toprint=1; next} {if (toprint) {print $1} }' \
/usr/share/X11/xkb/rules/base.lst | head -n -1 | fzf --layout=reverse --height=20)"
ask_password root ask_password root
ROOT_PASSWORD="$USER_PASSWORD" ROOT_PASSWORD="$USER_PASSWORD"

69
keyboard-map.csv Normal file
View File

@ -0,0 +1,69 @@
sr-cy,rs,pc105,,
sv-latin1,se,pc105,,
cf,ca(fr),pc105,,
fr_CH-latin1,ch,pc105,fr,
fr-latin9,fr,pc105,latin9,
dev,"dev,us",pc105,,"grp:shifts_toggle,grp_led:scroll"
sk-qwerty,sk,pc105,,qwerty
et,ee,pc105,,
ar-qwerty-digits,"ara,us",pc105,qwerty_digits,"grp:shifts_toggle,grp_led:scroll"
ar-azerty,"ara,us",pc105,azerty,"grp:shifts_toggle,grp_led:scroll"
ie,ie,pc105,,
ro-cedilla,ro,pc105,cedilla,
es,es,pc105,,
pl2,pl,pc105,,
cz-lat2,cz,pc105,qwerty,
ru,"ru,us",pc105,,"grp:shifts_toggle,grp_led:scroll"
dvorak,us,pc105,dvorak,
bg_bds-utf8,"bg,us",pc105,,"grp:shifts_toggle,grp_led:scroll"
no,no,pc105,,
de-latin1-nodeadkeys,de,pc105,nodeadkeys,
ben,"in,us",pc105,ben,"grp:shifts_toggle,grp_led:scroll"
ar-azerty-digits,"ara,us",pc105,azerty_digits,"grp:shifts_toggle,grp_led:scroll"
ar-qwerty,"ara,us",pc105,qwerty,"grp:shifts_toggle,grp_led:scroll"
tj,tj,pc105,,
ro-std-cedilla,ro,pc105,std_cedilla,
pt-latin1,pt,pc105,,
us-acentos,us,pc105,intl,
ro,ro,pc105,,
br-abnt2,br,abnt2,,
ar-digits,"ara,us",pc105,digits,"grp:shifts_toggle,grp_led:scroll"
cz-us-qwertz,"cz,us",pc105,,"grp:shifts_toggle,grp_led:scroll"
it-ibm,it,pc105,,
bg_pho-utf8,"bg,us",pc105,",phonetic","grp:shifts_toggle,grp_led:scroll"
fr-pc,fr,pc105,,
dk,dk,pc105,,
be-latin1,be,pc105,,
sg-latin1,ch,pc105,de_nodeadkeys,
fr-latin1,fr,pc105,,
ua-utf,"ua,us",pc105,,"grp:shifts_toggle,grp_led:scroll"
tml-uni,"in,us",pc105,tam_TAB,"grp:shifts_toggle,grp_led:scroll"
it,it,pc105,,
fr,fr,pc105,,
dk-latin1,dk,pc105,,
fr_CH,ch,pc105,fr,
fi,fi,pc105,,
sr-latin,rs,pc105,latin,
hu,hu,pc105,,
it2,it,pc105,,
fi-latin1,fi,pc105,,
ben-probhat,"in,us",pc105,ben_probhat,"grp:shifts_toggle,grp_led:scroll"
croat,hr,pc105,,
jp106,jp,jp106,,
hu101,hu,pc105,qwerty,
slovene,si,pc105,,
tml-inscript,"in,us",pc105,tam,"grp:shifts_toggle,grp_led:scroll"
de-latin1,de,pc105,,
ro-std,ro,pc105,std,
ko,kr,pc105,,
us,us,pc105+inet,,
la-latin1,latam,pc105,,
gur,"gur,us",pc105,,"grp:shifts_toggle,grp_led:scroll"
de,de,pc105,,
is-latin1,is,pc105,,
uk,gb,pc105,,
guj,"in,us",pc105,guj,"grp:shifts_toggle,grp_led:scroll"
trq,tr,pc105,,
mk-utf,"mkd,us",pc105,,"grp:shifts_toggle,grp_led:scroll"
nl,nl,pc105,,
sg,ch,pc105,de_nodeadkeys,
1 sr-cy rs pc105
2 sv-latin1 se pc105
3 cf ca(fr) pc105
4 fr_CH-latin1 ch pc105 fr
5 fr-latin9 fr pc105 latin9
6 dev dev,us pc105 grp:shifts_toggle,grp_led:scroll
7 sk-qwerty sk pc105 qwerty
8 et ee pc105
9 ar-qwerty-digits ara,us pc105 qwerty_digits grp:shifts_toggle,grp_led:scroll
10 ar-azerty ara,us pc105 azerty grp:shifts_toggle,grp_led:scroll
11 ie ie pc105
12 ro-cedilla ro pc105 cedilla
13 es es pc105
14 pl2 pl pc105
15 cz-lat2 cz pc105 qwerty
16 ru ru,us pc105 grp:shifts_toggle,grp_led:scroll
17 dvorak us pc105 dvorak
18 bg_bds-utf8 bg,us pc105 grp:shifts_toggle,grp_led:scroll
19 no no pc105
20 de-latin1-nodeadkeys de pc105 nodeadkeys
21 ben in,us pc105 ben grp:shifts_toggle,grp_led:scroll
22 ar-azerty-digits ara,us pc105 azerty_digits grp:shifts_toggle,grp_led:scroll
23 ar-qwerty ara,us pc105 qwerty grp:shifts_toggle,grp_led:scroll
24 tj tj pc105
25 ro-std-cedilla ro pc105 std_cedilla
26 pt-latin1 pt pc105
27 us-acentos us pc105 intl
28 ro ro pc105
29 br-abnt2 br abnt2
30 ar-digits ara,us pc105 digits grp:shifts_toggle,grp_led:scroll
31 cz-us-qwertz cz,us pc105 grp:shifts_toggle,grp_led:scroll
32 it-ibm it pc105
33 bg_pho-utf8 bg,us pc105 ,phonetic grp:shifts_toggle,grp_led:scroll
34 fr-pc fr pc105
35 dk dk pc105
36 be-latin1 be pc105
37 sg-latin1 ch pc105 de_nodeadkeys
38 fr-latin1 fr pc105
39 ua-utf ua,us pc105 grp:shifts_toggle,grp_led:scroll
40 tml-uni in,us pc105 tam_TAB grp:shifts_toggle,grp_led:scroll
41 it it pc105
42 fr fr pc105
43 dk-latin1 dk pc105
44 fr_CH ch pc105 fr
45 fi fi pc105
46 sr-latin rs pc105 latin
47 hu hu pc105
48 it2 it pc105
49 fi-latin1 fi pc105
50 ben-probhat in,us pc105 ben_probhat grp:shifts_toggle,grp_led:scroll
51 croat hr pc105
52 jp106 jp jp106
53 hu101 hu pc105 qwerty
54 slovene si pc105
55 tml-inscript in,us pc105 tam grp:shifts_toggle,grp_led:scroll
56 de-latin1 de pc105
57 ro-std ro pc105 std
58 ko kr pc105
59 us us pc105+inet
60 la-latin1 latam pc105
61 gur gur,us pc105 grp:shifts_toggle,grp_led:scroll
62 de de pc105
63 is-latin1 is pc105
64 uk gb pc105
65 guj in,us pc105 guj grp:shifts_toggle,grp_led:scroll
66 trq tr pc105
67 mk-utf mkd,us pc105 grp:shifts_toggle,grp_led:scroll
68 nl nl pc105
69 sg ch pc105 de_nodeadkeys

View File

@ -22,7 +22,7 @@ quiet() {
} }
### CD TO MY DIR ### ### CD TO MY DIR ###
cd "$(basename "$0")" cd "$(dirname "$0")"
### URLs ### ### URLs ###
DOTFILES="https://github.com/augustogunsch/dotfiles" DOTFILES="https://github.com/augustogunsch/dotfiles"