aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2017-03-11 19:14:10 +0100
committerRasmus Steinke <rasi@xssn.at>2017-03-11 19:14:10 +0100
commit748eb8ec392c21424ccd9fbefef2b3ee0fce2ab3 (patch)
tree43d6a389a98e7e8e6770d03363e86f214e2195b8
parente72d58a655710319268371ac735616b17d2e6863 (diff)
downloadrofi-pass-748eb8ec392c21424ccd9fbefef2b3ee0fce2ab3.tar.gz
try to detect keyboard layout
-rw-r--r--config.example5
-rwxr-xr-xrofi-pass3
2 files changed, 6 insertions, 2 deletions
diff --git a/config.example b/config.example
index 3e3c8bf..471fe6c 100644
--- a/config.example
+++ b/config.example
@@ -6,8 +6,9 @@ _rofi () {
rofi -i -width 700 -no-levenshtein-sort "$@"
}
-# keyboard layout (set this to your actual layout. E.g. keyboard="de us"
-keyboard=us
+# rofi-pass tries to detect keyboard layout automatically
+# if this fails try to set it manually here.
+# keyboard=us
# fields to be used
URL_field='url'
diff --git a/rofi-pass b/rofi-pass
index c0d72df..53e5de5 100755
--- a/rofi-pass
+++ b/rofi-pass
@@ -563,6 +563,9 @@ fi
if [[ -n $keyboard ]]; then
setxkbmap ${keyboard}
+else
+ keyboard=$(setxkbmap -query | grep layout | grep -oE '[^: ]+$')
+ setxkbmap ${keyboard}
fi
# set help color