All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Velikov <emil.l.velikov@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: emil.l.velikov@gmail.com
Subject: [PATCH] WIP: dim: introduce XDG_CONFIG_HOME support
Date: Tue, 23 Oct 2018 16:15:54 +0100	[thread overview]
Message-ID: <20181023151554.10177-1-emil.l.velikov@gmail.com> (raw)

From: Emil Velikov <emil.velikov@collabora.com>

Currently we check for $DIM_CONFIG, falling back to $HOME/.dimrc.

Instead of always setting DIM_CONFIG, add support for XDG_CONFIG_HOME
aka ~/.config.

Now we get $DIM_CONFIG > $XDG_CONFIG_HOME/dim/config > $HOME/.dimrc

Ideally in the future we'll:
 a) warn and kill off the last one
 b) print an warning message each time DIM_CONFIG is set
 c) error out if XDG_CONFIG_HOME is not set ...
or fallback to ~/.config ourselves

Reason being, managing dotfiles with XDG is an order of magnitude
easier and DIM_CONFIG should only be set as a temporary workaround.

TODO: better sales pitch, update docs

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
---
As the WIP/TODO suggests, this is not the final version of the patch.
Sending it out to get some feedback on the idea and a/b/c thinking.

Thanks
Emil
---
 dim | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dim b/dim
index 21e1e0d6ed45..93e90a4f96d0 100755
--- a/dim
+++ b/dim
@@ -36,7 +36,8 @@ set -e
 #
 
 # dim configuration file
-DIM_CONFIG=${DIM_CONFIG:-$HOME/.dimrc}
+XDG_DIM_CONFIG=${XDG_CONFIG_HOME:+$XDG_CONFIG_HOME/dim/config}
+DIM_CONFIG=${DIM_CONFIG:-${XDG_DIM_CONFIG:-$HOME/.dimrc}}
 if [ -r $DIM_CONFIG ]; then
 	# shellcheck source=/dev/null
 	. $DIM_CONFIG
-- 
2.19.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

                 reply	other threads:[~2018-10-23 15:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20181023151554.10177-1-emil.l.velikov@gmail.com \
    --to=emil.l.velikov@gmail.com \
    --cc=dri-devel@lists.freedesktop.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.