Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/9viz/declutter-home

declutter your home directory!
https://github.com/9viz/declutter-home

Last synced: 5 days ago
JSON representation

declutter your home directory!

Awesome Lists containing this project

README

        

#+TITLE: declutter-home
#+AUTHOR: Visuwesh

* Disclaimer

This repository is bound to get outdated and have broken links as time
goes on. I no longer engage in the work that will be highlighted
below so I do not feel any need or /responsibility/ to fix these.
Moreover, I might not add new information to this repository but if
you have any, or want to fix any broken links and outdated/mis-
information, please send a patch to visuweshm [at] gmail [dot] com.

P.S. I am not responsible for any breakage whatsoever. You engaged in
this madness by yourself.

* Dotfiles---Origin and History

In an attempt to make ls not list "." and ".." [1], a bug introduced
the notion of hidden files (or "dotfiles") which was subsequently
abused by people and hence became a "feature".

This misfeature was completely removed in Plan 9. Plan 9 follows a
sane hierarchy and even has a XDG_CONFIGURATION_HOME/XDG_DATA_HOME
like directory---~/lib.

* Freedesktop's XDG Environment Variables

Freedesktop defines numerous environment variables [2] that helps to
keep the home directory organised and the data grouped in a hierarchy.
Declaring them goes a long way in keeping the home directory tidy but
some of the older software might/do not follow this.

The basic environmental variables are listed below for your
convenience,

1. XDG_CACHE_HOME
2. XDG_CONFIG_HOME
3. XDG_DATA_HOME

Refer to [2] to learn what they mean.

* Application-specific Environment Variables

As hinted in the previous section, some software do not follow the XDG
convention. Some of these outliers have an environment variable or a
flag that allows you to change the directory used to store the data.
A table of known environment variable/flag is listed below.

| Software | Environmental variable(s) | Flag(s) |
|---------------+---------------------------+-----------------------|
| dialog | DIALOGRC | - |
| dunst | - | -conf |
| GIMP | GIMP2_DIRECTORY | - |
| gnupg | GNUPGHOME | - |
| ksh (a) | ENV | - |
| less | LESSHISTFILE | - |
| mail | MAIL MAILRC | - |
| neovim (b) | NVIM_LOG_FILE | - |
| pass | PASSWORD_STORE_DIR | - |
| picom | - | --config |
| pulseaudio | PULSE_COOKIE | - |
| python | PYTHONPATH PYTHONUSERBASE | - |
| readline | INPUTRC | - |
| shell history | HISTFILE | - |
| sxhkd | - | -c |
| wget | - | --no-hsts --hsts-file |
| xauth | XAUTHORITY | - |
| xinit | XINITRC | - |
| zsh (c) | ZDOTDIR | - |

- a :: MKSHRC_PATH can be changed during compile time to change the
shellrc filename if you use mksh.
- b :: Nvim creates .nvimlog in the current directory by default.
- c :: Set it in /etc/zsh/zshenv [3].

If you are confused about all the files used by Xorg, consult
https://nixers.net/showthread.php?tid=2271.

* Workaround

If neither of the options are available, you can either try patching
the software or writing a wrapper script that temporarily sets the
HOME directory for the software. As an example, consider a script for
Firefox,

#+BEGIN_EXAMPLE
#!/bin/sh

HOME=$HOME/firefox_junk firefox $@
#+END_EXAMPLE

Xfce apps ignores this. You have to launch xfconfd with the modified
HOME directory; this is likely located at /lib/xfce4/xfconf/xfconfd.

See also https://wiki.zakaria.org/privsec/home.html.

* Patches

If you find the workaround ugly, or if the software is resilient, you
can try patching it. Patching usually requires a minimal working
knowledge of the language used but for our purposes, familiarity with
the shell should be enough.

An oversimplified outline of the process looks like,

#+BEGIN_EXAMPLE
% grep -R '\.software'
[output]
% sed 's|\.software||g' files
#+END_EXAMPLE

You might find some of my patches in https://github.com/vizs/ports
useful.

* Structure

To reduce chaos, you need structure but too rigid of a structure
becomes a chore an annoyance [*] so some chaos is desirable. A
vaguely organised home directory also helps you in writing scaleable
scripts that analyse the directory structure to work. Pick something
that works for you. No example will be provided since this is
something that YOU have to decide for yourself.

[*] This is part of the reason why I do not follow the practises
listed in the repository. At some point, it became a chore
and I lost interest in maintaining a pristine home directory
for the sake of internet points.

* References

1. http://xahlee.info/UnixResource_dir/writ/unix_origin_of_dot_filename.html
2. https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html
3. https://github.com/vizs/declutter-home/issues/1

* See Also

1. https://github.com/dylanaraps/clutter-home
2. https://nixers.net/showthread.php?tid=1293
3. https://nixers.net/showthread.php?tid=2271
4. https://wiki.zakaria.org/privsec/home.html