From: Maximilian Bosch <maximilian@mbosch.me>
To: zsh-workers@zsh.org
Subject: PATCH: search XDG_DATA_DIRS in _setxkbmap completion
Date: Tue, 18 Sep 2018 14:49:51 +0200 [thread overview]
Message-ID: <20180918124951.4nbyjhbuqnkioqrt@hauptschuhle> (raw)
[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]
Hi,
this patch searches in $XDG_DATA_DIRS for `<XDG_DATA_DIR>/share/X11/xkb`
rather than using `/usr/lib` and `/usr/share`.
This is helpful on distros such as NixOS which don't adopt the FHS[1][2].
Maximilian
[1] https://github.com/NixOS/nixpkgs/pull/46152#issuecomment-421755892
[2] https://github.com/NixOS/nixpkgs/issues/46025
diff --git a/Completion/X/Command/_setxkbmap b/Completion/X/Command/_setxkbmap
index f7310ecdd..b3f8b1a46 100644
--- a/Completion/X/Command/_setxkbmap
+++ b/Completion/X/Command/_setxkbmap
@@ -10,12 +10,18 @@ _setxkbmap() {
# 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
+ setopt sh_word_split
+ local IFS=:
+ for dir in $XDG_DATA_DIRS; do
+ fullName="$dir/X11/xkb"
+ if [ -d $fullName ] ; then
+ sourcedir=$fullName
break
fi
done
+ unset IFS
+ unsetopt sh_word_split
+
[ -d $sourcedir ] || return 1
local -a arguments
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next reply other threads:[~2018-09-18 12:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-18 12:49 Maximilian Bosch [this message]
2018-09-18 16:10 ` Daniel Shahaf
2018-09-18 19:05 ` Maximilian Bosch
2018-09-18 19:32 ` Daniel Shahaf
2018-09-19 20:36 ` Maximilian Bosch
2018-09-19 21:30 ` Daniel Shahaf
2018-09-19 4:53 TS
2018-09-19 14:29 ` Daniel Shahaf
2018-09-19 19:53 ` TS
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180918124951.4nbyjhbuqnkioqrt@hauptschuhle \
--to=maximilian@mbosch.me \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).