The Greatest Linux Customization of All Time
created - changed 6e3d64aI have been ricing my Linux for about as long as I’ve been using it. I can’t help being facetious, okay? Sue me!
What I’m about to disclose to you, however, may be the greatest customization I have ever applied to my machine. By a mile. Really, it’s not even close.
You might be aware that directories like ~/Desktop and ~/Documents can be
created automatically by
xdg-user-dirs,
which also provides some convenient environment variables so that different
applications can get their locations programmatically. If you’re anything like
me, however, this functionality just won’t cut it. All of my makefiles are
makefile. All of my docker files are dockerfile. All of my projects are
stored in ~/code. Capital letters? In my fortress of productivity1 and
lowercase majesty? This is an untenable burden and reason enough to drop
everything in order to find a solution.
Naturally, then, I spent months (years, maybe…) toiling away under the yoke of
having to press shift for cd Documents and clone <some repo> ~/Downloads/<name>. I thought that this was simply my lot in life, that there
was no existence but the suffering I endured. Then, finally, a light shone upon
me, and a voice echoed down from the heavens, blessing me with its ancient
wisdom:
There’s a config file for that…
Of course! A config file! There’s always a config file, and if you tweak it
just right, it will finally unlock the key to living a happy and productive
life. In this case, it lived at ~/.config/user-dirs.dirs, and it had to be
created like so:
1XDG_DESKTOP_DIR="$HOME/desktop"
2XDG_DOCUMENTS_DIR="$HOME/documents"
3XDG_DOWNLOAD_DIR="$HOME/downloads"
4XDG_MUSIC_DIR="$HOME/music"
5XDG_PICTURES_DIR="$HOME/pictures"
6XDG_PUBLICSHARE_DIR="$HOME/public"
7XDG_TEMPLATES_DIR="$HOME/templates"
8XDG_VIDEOS_DIR="$HOME/videos"Unfortunately, one final task remained: renaming all of these stupid directories manually. This is Linux, we can’t just have something nice. Finally, though, as if the weight of the world had been lifted from my shoulders, I had finally been granted my deepest wish: lowercase common directories. I can say with absolute certainty that the time I spent figuring out how to do this, amortized over every time I won’t have to press shift2 for the rest of my life, will 100% pay for itself in spades.
It’s hard to say how many apps will actually respect this, but worth noting that
xdg-user-dir <type> will return an absolute path to any one of these without
issue, allowing us to write scripts that will be completely portable between us
high-minded sophisticates and the simpletons who have to use them3. If
nothing else, it gives me some low-hanging fruit to submit a PR about if I have
to use something that disturbs my sanctuary by ignoring it. Maybe then my resume
will start to look like I actually know how to write software.
Truly, it is a glorious day.
-
citation needed… ↩︎
-
at the risk of being a joke explainer/killjoy here, the fact of the matter is after implementing a tmux sessionizer-esque workflow, I actually don’t spend that much time
cding into a particular directory anyways. ↩︎ -
speaking as someone who has never taken something from someone else’s dotfiles. ↩︎