💾 Archived View for kota.nz › notes › xdg-dirs captured on 2022-03-01 at 15:19:52. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-11-30)
-=-=-=-=-=-=-
2020/12/17
My home dir looks like this.
$ ls -1F TODO bin@ desk/ docs/ dots/ g/ git/ go/ music/ pics/ tmp/ vids/ vm/
Turns out you can rename all that shit, but it's not quite as simple as firing off a few mv commands.
Every decently written program designed to run on UNIX/Linux conforms, at least in part, to the freedesktop standards. (Although Steam is a notable and very annoying exception.) Among other things, this standard specifies locations which store different types of data such as "config files," "cache," and even things like your download and picture folders.
Since there are libraries written in nearly every popular language, this makes it really easy for developers to know where you want stuff without every program needing to independently ask you, or worse, guess.
As a user, we can configure these values to our liking. Some are just environment variables (stored either in your shell's config or .profile). The major ones are XDG_CONFIG_HOME, XDG_CACHE_HOME, and XDG_DATA_HOME.
However, the ones you probably care about, which a file manager has the little icons for, are all stored in a file called user-dirs.dirs. That file is, of course located where all config files should be in XDG_CONFIG_HOME, which by default is just .config in your home directory.
$ cat .config/user-dirs.dirs # This file is written by xdg-user-dirs-update # If you want to change or add directories, just edit the line you're # interested in. All local changes will be retained on the next run # Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped # homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an # absolute path. No other format is supported. # XDG_DESKTOP_DIR="$HOME/desk" XDG_DOWNLOAD_DIR="$HOME/tmp" XDG_TEMPLATES_DIR="$HOME/docs/templates" XDG_PUBLICSHARE_DIR="$HOME/docs/share" XDG_DOCUMENTS_DIR="$HOME/docs" XDG_MUSIC_DIR="$HOME/music" XDG_PICTURES_DIR="$HOME/pics" XDG_VIDEOS_DIR="$HOME/vids"
After making that file, you should actually run all those mv commands of course.