diff options
Diffstat (limited to 'content')
| -rw-r--r-- | content/guide/clean_your_home.md | 91 |
1 files changed, 91 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..ec802a0 --- /dev/null +++ b/content/guide/clean_your_home.md @@ -0,0 +1,91 @@ +--- +title: Clean your $HOME +date: 2025-10-30T08:49:28+01:00 +index: false +draft: true +#icon: '' +#copied: ["me", "/"] +table: true +--- + +## 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 noticed that Neovim clones the plugin 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. 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 of their app, or the userdata. And this is annoying. It's funny how the more time goes by the more dotfiles there is in your `$HOME`. + +For example, if you use a firefox based browser your have `.mozilla`, you use adb ? `.android`, all your shell's config files like `.zshrc` are in your `$HOME` too. + +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. + +But hopefully, there's some kind of fix for that. + +## 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 command gives you a list of files that have XDG compliance, you have instructions about **how to** move them. If a file doesn't support XDG compliance, `xdg-ninja` returns a link to the issue being discussed. + +### 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` + +### Post cleaning + +Now I have 20 folders in my home directory, that's better. + +## Links + +- [List of programs supporting (or not) XDG BDS](https://wiki.archlinux.org/title/XDG_Base_Directory) +- [Luke Smith video](https://www.youtube.com/watch?v=yy8RoDSdhIQ) + |
