For my birthday last year, I decided that the time had come. Time for me to finally purchase a new laptop to replace my aging 2013 MacBook Air (RIP). Apple had slowly pushed me back to Linux, so I went with the excellent Lenovo X1 Carbon, whose 5th generation had come out earlier in 2017. It arrived nearly a month later. When the weekend came around, I flashed a USB drive with the latest Arch Linux Live image, rolled up my sleeves, and got to work.
As much as I want to regale you all with bountiful details of setting up a new Arch Linux installation, I’m here today with a specific purpose: to spread knowledge about XDG User Directories! I haven’t found a specification explaining the standard, but as usual, the Arch Linux wiki comes to the rescue!
So, in setting up my laptop, I was trying to figure out how to best organize my
home directory. I was used to macOS’s default layout with
Downloads, and so on. But since I was ditching macOS and its tyranny, why not
actually give this some thought. Eventually, I settled on the following:
~ ❯ ls build/ dev/ documents/ Dropbox/ music/ pictures/ public/ tmp/ videos/
I specifically wanted no
Desktop directory, to rename the
tmp, and to use lower-case folders in my home directory to
ease my life when typing them on the command line—where I live. Following the
wiki, I filled my
XDG_DESKTOP_DIR="$HOME/tmp/desktop" XDG_DOWNLOAD_DIR="$HOME/tmp" XDG_TEMPLATES_DIR="$HOME/documents/templates" XDG_PUBLICSHARE_DIR="$HOME/public" XDG_DOCUMENTS_DIR="$HOME/documents" XDG_MUSIC_DIR="$HOME/music" XDG_PICTURES_DIR="$HOME/pictures" XDG_VIDEOS_DIR="$HOME/videos"
And voila! All applications that follow the XDG User Directories spec—all the well-behaved ones at least—will now use the configured directories instead of the defaults.
Hmm, now if only I could get Dropbox to fall in line with the whole lower-case thing 🤔.