about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2018-09-19 22:36:17 +0200
committerDaniel Shahaf <d.s@daniel.shahaf.name>2018-09-19 21:24:28 +0000
commit624219e0e4cbfdfb286e707bd2853f2d7b6a4a7d (patch)
treeae26dba14995aa4487591f3f5ab26f145a876218
parent54d2c4fe5d4ea44dc6212f7c7dd119c4690c481e (diff)
downloadzsh-624219e0e4cbfdfb286e707bd2853f2d7b6a4a7d.tar.gz
zsh-624219e0e4cbfdfb286e707bd2853f2d7b6a4a7d.tar.xz
zsh-624219e0e4cbfdfb286e707bd2853f2d7b6a4a7d.zip
43502: Search XDG_DATA_DIRS in _setxkbmap completion
-rw-r--r--ChangeLog5
-rw-r--r--Completion/X/Command/_setxkbmap10
2 files changed, 11 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index af10661ca..87d6e9c3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-09-19  Maximilian Bosch  <maximilian@mbosch.me>
+
+	* 43502: Completion/X/Command/_setxkbmap: Search XDG_DATA_DIRS
+	in _setxkbmap completion
+
 2018-09-18  Oliver Kiddle  <okiddle@yahoo.co.uk>
 
 	* 43464: Completion/Linux/Command/_valgrind: complete options
diff --git a/Completion/X/Command/_setxkbmap b/Completion/X/Command/_setxkbmap
index f7310ecdd..486268ed7 100644
--- a/Completion/X/Command/_setxkbmap
+++ b/Completion/X/Command/_setxkbmap
@@ -9,10 +9,12 @@ _setxkbmap() {
     setopt extendedglob
 
     # xkb files may be in different places depending on system
-    local dir sourcedir
-    for dir in /usr/lib/X11/xkb /usr/share/X11/xkb; do
-        if [ -d $dir ] ; then
-           sourcedir=$dir
+    local dir sourcedir fullname
+    local -a searchdirs=(${XDG_DATA_HOME:-~/.local/share} ${(s.:.)XDG_DATA_DIRS:-/usr/lib:/usr/share:/usr/local/lib:/usr/local/share})
+    for dir in $searchdirs; do
+        fullname="$dir/X11/xkb"
+        if [ -d $fullname ] ; then
+           sourcedir=$fullname
            break
         fi
     done