[PATCH] WIP: dim: introduce XDG_CONFIG_HOME support

Jani Nikula jani.nikula at linux.intel.com
Wed Oct 31 08:31:11 UTC 2018


On Tue, 30 Oct 2018, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> On Mon, 29 Oct 2018 at 07:09, Jani Nikula <jani.nikula at linux.intel.com> wrote:
>>
>> On Wed, 24 Oct 2018, Daniel Vetter <daniel at ffwll.ch> wrote:
>> > On Tue, Oct 23, 2018 at 04:33:09PM +0100, Emil Velikov wrote:
>> >> From: Emil Velikov <emil.velikov at 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 at 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.
>> >
>> > I think this makes sense. Instead of warning I think we could just ship a
>> > dim version for a few weeks that automatically moves the old ~/.dimrc to
>> > the new XDG approved location.
>>
>> Please don't automatically move users' files. You can warn about using
>> the old location and tell people to move, but don't move them
>> automatically.
>>
> Right to sum it up, I'll do the following:
>
>  - add XDG support for the following files
>
> .dimrc
> .dim-last-path
> .dim-update-check-timestamp
> .dim.template.hello
> .dim.template.signature
>
>  - a warning will be printed when using the 'old' files

Maybe even delay that deprecation patch for a bit after adding the XDG
support, and send a deprecation announcement on dim-tools first? People
get annoyed when auto-updating tools screw up their workflows when they
least expect or want it. ;)

>  - ^^ will include mv suggestion, and note that old ones will not work
> after say 1 month?

Sounds good.

>  - after the due date a brave soul can flip the switch :-)
>  - misc: last-path/check-timestamp - worth adding config overrides?

Nah, I think I was too accommodating with the configs in the
beginning. ;)

Maybe DIM_CONFIG should specify a directory instead of a file, and the
configs would be relative to that. Could deprecate DIM_TEMPLATE_HELLO
and DIM_TEMPLATE_SIGNATURE env vars too. But these can be left as
follow-up, unless doing so helps you get at your first goal. Up to you.

>  - misc: last-path/check-timestamp - should we consider those config or cache?

Good point, cache I think.

Thanks for doing this. When I added .dimrc support 4½ years (!!!) ago it
was to support the doubling of the user base from 1 to 2. We didn't
think we'd have this many users or this many files, and frankly XDG
didn't even cross our minds. It's obvious *now* that putting all that
stuff to $HOME was a bad idea, but hindsight 20/20.

BR,
Jani.

>
> Thanks
> Emil

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the dim-tools mailing list