question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use XDG standard directories instead of hidden files in the home directory

See original GitHub issue

Would it be possible to change (or, at as an option) the default locations of ~/.proplotrc and ~/.proplot/fonts and so on to the corresponding XDG standards? A description may be found here:

https://wiki.archlinux.org/index.php/XDG_Base_Directory

The standard has been gaining steam in the past five or so years; the idea is that apps don’t have to litter the home directory with dot files, which makes backing up configuration files easier (not to mention, it keeps the home directory tidy!).

The TLDR is that:

  • The file ~/.proplotrc should be moved to ~/.config/proplot/proplotrc
  • The folders ~/.proplot/* should be moved to ~/.config/proplot/*

(Actually, ~/.config is more generally the value of the environment variable XDG_CONFIG_HOME.)

Happy to submit a PR if there is interest.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
lukelbdcommented, Jul 20, 2020

No problem! Yep, I just meant that when proplot is looking for “loose” proplotrc files (including $HOME/proplotrc, $PWD/proplotrc, $PWD/../proplotrc, etc.), it should also look for the hidden filename version .proplotrc. And the justifications for supporting both going forward are:

  1. Backwards compatibility: Older proplot versions supported only hidden .proplotrc files
  2. Supporting both hidden/unhidden file names for “loose” configuration files has precedent, because both approaches have advantages: Hidden files are less obtrusive, but unhidden files are more obvious and less likely to surprise the user.

For proplotrc files inside proplot and .proplot subfolders, I suppose there is no reason to support the hidden .proplotrc version, since the config file is not obtrusive (it is sequestered in a separate subfolder). But I can see the argument for making .proplotrc and proplotrc synonymous everywhere (less confusing for users). Ambivalent on this.

There should probably be a public RcConfigurator.config_paths method or similar that shows the location of all proplotrc files observed by proplot, but that might be a separate issue/PR.

1reaction
lukelbdcommented, Jul 19, 2020

Thought this issue would pop up eventually. Was aware of the standard, but I avoided it basically out of laziness and because I’m used to dumping everything in $HOME… I guess lazy developers are the main impediment to this standard being adopted 😉

We could address this by going the way of vim: permit both ~/.proplot and $XDG_CONFIG_HOME/proplot for the configuration folder, and permit all of ~/.proplotrc, ~/.proplot/proplotrc, and $XDG_CONFIG_HOME/proplot/proplotrc for the configuration file. We can issue a warning message when a proplotrc file is found in more than one of these locations, but still read all of them. A default proplotrc file will be generated in the XDG standard location only if all 3 of these paths are empty.

For consistency, we should also detect local files named proplotrc (without the leading dot), but we can continue to detect .proplotrc files for backwards compatibility. There already seems to be some precedent for allowing both hidden and non-hidden versions of configuration files (e.g. the readthedocs configuration).

This isn’t an immediate priority but happy to accept PRs in the meantime. The relevant code is here:

https://github.com/lukelbd/proplot/blob/abdca188a7588d35f81b1362fbdbbe258c84a6df/proplot/config.py#L509-L532

The default proplotrc file is generated here:

https://github.com/lukelbd/proplot/blob/abdca188a7588d35f81b1362fbdbbe258c84a6df/proplot/config.py#L1529-L1533

The .proplot data paths (containing colormaps, cycles, fonts) are defined here:

https://github.com/lukelbd/proplot/blob/abdca188a7588d35f81b1362fbdbbe258c84a6df/proplot/config.py#L166-L180

Read more comments on GitHub >

github_iconTop Results From Across the Web

XDG Base Directory - ArchWiki
Application Legacy Path Supported Since ALSA ~/.asoundrc 577df36 · 1.2.3 Android Studio ~/.AndroidStudioX.X Android Studio 4.1 Anki ~/Anki , ~/Documents/Anki
Read more >
Declutter Your Home Directory With The XDG Base ... - YouTube
I noticed that my home directory was becoming an absolute mess recently I had so many files in it that shouldn't have been...
Read more >
The Power of the XDG Base Directory Specification
Everyone knows that feeling, you type an ls -la in your home directory, or something similar which lists also hidden files and you...
Read more >
Store settings and packages in XDG directories ... - GitHub
$XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored. If $XDG_CONFIG_HOME is either ...
Read more >
Using or deleting default directories in /home - Ask Ubuntu
In Linux, configuration is kept in hidden files or hidden folders ("hidden" in Linux means that the file or folder name starts with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found