From db8282e3d3beb0d89475f911060db2b1b17ed227 Mon Sep 17 00:00:00 2001 From: Rasmus Steinke Date: Sun, 21 May 2017 21:10:27 +0200 Subject: [PATCH] let the user enter their own setxkbmap command. more error-prone and flexible --- config.example | 14 ++++++-------- rofi-pass | 24 +----------------------- 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/config.example b/config.example index 098a036..818cb11 100644 --- a/config.example +++ b/config.example @@ -9,15 +9,13 @@ _rofi () { # xdotool needs the keyboard layout to be set using setxkbmap # You can do this in your autostart scripts (e.g. xinitrc) -# Alternatively you can set your options here and set fix_layout to "true" -# rofi-pass will try to autodetect correct settings, if no layout is set (not recommended) -# if model is unset, rofi-pass defaults to 'pc104' - +# If for some reason, you cannot do this, you can set the command here. +# and set fix_layout to true fix_layout=false -model=pc104 -layout=us -#variant=us -#option=compose:caps + +layout_cmd () { + setxkbmap us +} # fields to be used URL_field='url' diff --git a/rofi-pass b/rofi-pass index c905f59..61c3b32 100755 --- a/rofi-pass +++ b/rofi-pass @@ -597,29 +597,7 @@ fi # fix keyboard layout if enabled in config if [[ $fix_layout == "true" ]] then - if [[ -z $model ]] - then - model=pc104 - fi - if [[ -n $layout ]] - then - if [[ -n $variant && -n $option ]] - then - setxkbmap -model $model -layout $layout -variant $variant -option $option - elif [[ -n $variant && -z $option ]] - then - setxkbmap -model $model -layout $layout -variant $variant - elif [[ -z $variant && -n $option ]] - then - setxkbmap -model $model -layout $layout -option $option - elif [[ -z $variant && -z $option ]] - then - setxkbmap -model $model -layout $layout - fi - else - keyboard=$(setxkbmap -query | grep -E 'layout|variant' | grep -oE '[^: ]+$' | tr '\n' ' ') - setxkbmap ${keyboard} - fi + layout_cmd fi # set help color