Home directories

I'd say that under a user's home dir, all program stuff should be under one of those dirs, and nowhere else.

config and state may be a bit fuzzy, because in a way some state may be config, but modified in a different way, and that could get us into persistence.

Directory .config ($XDG_CONFIG_HOME)

For stuff that the user specified explicitely (I'd make the disctinction of things the user may edit with a text editor).

Directory .state ($XDG_DATA_HOME ??)

For stuff like history, be it command or URLs etc., logs, window position. But you may consider some of those as a different kind of config like UI config, also .state could be all session related stuff.

While it might be desirable to backup and share state information, it should contain things that have less value than editable configuration.

Some people might want to store .config but not .state under an SCM for example.

Directory .cache ($XDG_CACHE_HOME)

For stuff that can be removed because it can be regenerated or reretrieved. Thinks like thumbnails, ccache data.

Directory .temp ($TMP, $TEMP, etc)

For stuff that is temporary, used during the program execution and can be removed once the program is not running anymore.