summaryrefslogtreecommitdiff
path: root/content/guide/clean-your-home.md
diff options
context:
space:
mode:
Diffstat (limited to 'content/guide/clean-your-home.md')
-rw-r--r--content/guide/clean-your-home.md95
1 files changed, 95 insertions, 0 deletions
diff --git a/content/guide/clean-your-home.md b/content/guide/clean-your-home.md
new file mode 100644
index 0000000..3ae8b51
--- /dev/null
+++ b/content/guide/clean-your-home.md
@@ -0,0 +1,95 @@
+---
+title: Clean your $HOME
+date: 2025-10-30T08:49:28+01:00
+#icon: ''
+---
+
+## XDG Base Directory
+
+### Introduction
+
+The [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir/latest/) (let's abbreviate it to XDG-BDS to be short) defines base directories.
+
+For example, you probably noticed that Neovim clones plugins in `$XDG_DATA_HOME` which translates by default to `$HOME/.local/share/`.
+
+Thanks to this specification, there is a convention for apps to use specific folders to store or look for data. For example, Neovim (and Helix, and your terminal emulator and so on) use `$XDG_CONFIG_HOME` to look for your configuration files.
+
+### The problem
+
+There is tons of app who doesn't use the XDG BDS, and so they kind of pick the place they like to put the cache or the userdate of their app (and this is annoying).
+
+Just look at how the more time goes by, the more dotfiles there is in your `$HOME`.
+
+For example, if you use a firefox based browser you have `.mozilla`. You use adb ? Here is your `~/.android`. And of course all of your shell's config files like `.zshrc` are in your `$HOME` too.
+
+### Quick verification
+
+Look at your `$HOME` :
+
+```sh
+ls -a ~/
+```
+
+Doesn't it look messy ? Pipe it into word count :
+
+```sh
+ls -a ~/ | wc -l
+```
+
+I have 31 files in my `$HOME`. And I clean it regularly. I would really like to have only my XDG Base Directories in my HOME, but as I said, some apps don't support XDG BDS.
+
+But fortunately, there are some programs like zsh, or git that do support XDG BDS, they just (by default) look for/create files in $HOME.
+
+## xdg-ninja
+
+[xdg-ninja](https://github.com/b3nj5m1n/xdg-ninja) is a shell script that checks if the files in your home directory support XDG BDS.
+
+Running the script gives you a list of files that have XDG compliance, you have instructions about **how to** remove them from your HOME. And if a file doesn't support XDG compliance, `xdg-ninja` returns a link to the issue being discussed on the internet.
+
+### Installation
+
+Of course, on Arch-based distros it's really easy :
+
+```sh
+paru -S xdg-ninja
+sudo pacman -S glow # optional (for pretty printing)
+```
+
+And if you don't have an AUR helper, just clone the repo :
+
+```sh
+git clone https://github.com/b3nj5m1n/xdg-ninja
+```
+
+You can then use the `xdg-ninja.sh` script in the folder.
+
+Check their `README` for more download instructions.
+
+### Usage
+
+I am just going to use it, and tell you what they ask me to do.
+
+So just run the shell script, and the first things **I get** are warnings about variables I didn't set in my shell's config file. So let's add them :
+
+```sh
+export XDG_CONFIG_HOME=$HOME/.config
+export XDG_DATA_HOME=$HOME/.local/share
+export XDG_STATE_HOME=$HOME/.local/state
+export XDG_CACHE_HOME=$HOME/.cache
+```
+
+And now for each file they talk about I have to follow the instruction.
+
+For example they tell me that the `$HOME/.gitconfig` can be moved in `~/.config/git/config`
+
+And you only have to do this for every file they list.
+
+### Post cleaning
+
+Now I have 20 folders in my home directory, that's better.
+
+## Links
+
+- [List of programs supporting (or not) the XDG Base Directory Specification](https://wiki.archlinux.org/title/XDG_Base_Directory)
+- [Luke Smith video](https://videos.lukesmith.xyz/w/t5WcCYv58zDur45LRC1KFE)
+