[PATCH v2 app/setxkbmap] Add ~/.xkb and xdg dir to search path

Peter Hutterer peter.hutterer at who-t.net
Mon Jun 26 03:36:44 UTC 2017


[off-list]

Hi Mihail,

First, sorry for dropping this, I wasn't cc'd on the patch and it
disappeared into a black hole. Only dug this out today because the whole
user-specific xkb configuration came up elsewhere and I had a vague
recollection of it.

I have a question though on how you're currently using this whole thing:
do you have a full install of xkeyboard-config in $XDG_CONFIG_HOME and just
modify that with the custom keymap you have? Can you talk me through your
setup and how the whole thing fits together? THanks

Cheers,
   Peter

On Tue, Nov 22, 2016 at 10:37:04AM +0500, Mihail Konev wrote:
> Signed-off-by: Mihail Konev <k.mvc at ya.ru>
> ---
> Whichever directories get added, they should not differ from libxkbcommon
> not to "break per-user installs" between setxkbmap and users of the latter :)
> 
>  setxkbmap.c | 36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
> 
> diff --git a/setxkbmap.c b/setxkbmap.c
> index cf0f02d6e704..42b8c3f04137 100644
> --- a/setxkbmap.c
> +++ b/setxkbmap.c
> @@ -381,6 +381,40 @@ setOptString(int *arg, int argc, char **argv, setting_t *setting, enum source sr
>  /***====================================================================***/
>  
>  /**
> + * Retrieve name of ~/.config/xkb directory.
> + */
> +char *
> +get_xdg_dir()
> +{
> +    static char path[PATH_MAX];
> +
> +    const char *home = getenv("HOME");
> +    const char *xdg = getenv("XDG_CONFIG_HOME");
> +    int rc;
> +
> +    if (xdg != NULL)
> +        snprintf(path, sizeof path, "%s/xkb", xdg);
> +    else
> +        snprintf(path, sizeof path, "%s/.config/xkb", home);
> +    return path;
> +}
> +/**
> + * Retrieve name of ~/.xkb directory.
> + */
> +char *
> +get_dot_dir()
> +{
> +    static char path[PATH_MAX];
> +
> +    const char *home = getenv("HOME");
> +    snprintf(path, sizeof path, "%s/.config/xkb", home);
> +    return path;
> +}
> +
> +
> +/***====================================================================***/
> +
> +/**
>   * Parse commandline arguments.
>   * Return True on success or False if an unrecognized option has been
>   * specified.
> @@ -394,6 +428,8 @@ parseArgs(int argc, char **argv)
>  
>      ok = True;
>      addToList(&inclPath, ".");
> +    addToList(&inclPath, get_xdg_dir());
> +    addToList(&inclPath, get_dot_dir());
>      addToList(&inclPath, DFLT_XKB_CONFIG_ROOT);
>      for (i = 1; (i < argc) && ok; i++)
>      {
> -- 
> 2.9.2
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list