Skip to content

Commit

Permalink
let the user enter their own setxkbmap command. more error-prone and …
Browse files Browse the repository at this point in the history
…flexible
  • Loading branch information
carnager committed May 21, 2017
1 parent 90889a9 commit db8282e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 31 deletions.
14 changes: 6 additions & 8 deletions config.example
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
24 changes: 1 addition & 23 deletions rofi-pass
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit db8282e

Please sign in to comment.