Add comment about keyboard layouts and set it if user explicitly asks for it

This commit is contained in:
Rasmus Steinke 2017-03-12 18:56:23 +01:00
parent 8d3f9e75bb
commit 1672ad4c60
2 changed files with 18 additions and 1 deletions

View File

@ -3,9 +3,14 @@
# rofi command. Make sure to have "$@" as last argument # rofi command. Make sure to have "$@" as last argument
_rofi () { _rofi () {
rofi -i -width 700 -no-levenshtein-sort "$@" rofi "$@"
} }
# If you want rofi-pass to set keyboard layout, enable this
# However It's recommended to call setxkbmap on login manually
# Setting it in Xorg config is not sufficient for some reason
fix_layout=false
# rofi-pass tries to detect keyboard layout automatically # rofi-pass tries to detect keyboard layout automatically
# if this fails try to set it manually here. # if this fails try to set it manually here.
# keyboard=us # keyboard=us

View File

@ -565,6 +565,18 @@ if [[ ! -d "$HOME/.cache/rofi-pass" ]]; then
mkdir "$HOME/.cache/rofi-pass" mkdir "$HOME/.cache/rofi-pass"
fi fi
# fix keyboard layout if enabled in config
if [[ $fix_layout == "true" ]]
then
if [[ -n $keyboard ]]
then
setxkbmap "${keyboard}"
else
keyboard=$(setxkbmap -query | grep -E 'layout|variant|options' | grep -oE '[^: ]+$' | tr '\n' ' ')
setxkbmap ${keyboard}
fi
fi
# set help color # set help color
if [[ $help_color == "" ]]; then if [[ $help_color == "" ]]; then
help_color=$(rofi -dump-xresources | grep 'rofi.color.normal' | gawk -F ',' '/,/{gsub(/ /, "", $2); print $2}') help_color=$(rofi -dump-xresources | grep 'rofi.color.normal' | gawk -F ',' '/,/{gsub(/ /, "", $2); print $2}')