diff --git a/config.example b/config.example index 471fe6c..a6166b6 100644 --- a/config.example +++ b/config.example @@ -3,9 +3,14 @@ # rofi command. Make sure to have "$@" as last argument _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 # if this fails try to set it manually here. # keyboard=us diff --git a/rofi-pass b/rofi-pass index fcd9282..59172f8 100755 --- a/rofi-pass +++ b/rofi-pass @@ -565,6 +565,18 @@ if [[ ! -d "$HOME/.cache/rofi-pass" ]]; then mkdir "$HOME/.cache/rofi-pass" 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 if [[ $help_color == "" ]]; then help_color=$(rofi -dump-xresources | grep 'rofi.color.normal' | gawk -F ',' '/,/{gsub(/ /, "", $2); print $2}')