├── README.md └── please-use-xdg.sh /README.md: -------------------------------------------------------------------------------- 1 | # XDG Base Directory Specification rulez 2 | 3 | ## Installation 4 | 5 | 1. Download `please-use-xdg.sh` 6 | 2. Source it in your `.profile` or shell configuration file 7 | 8 | ## Supported shells 9 | 10 | - Bash 11 | - ZSH 12 | - Fish 13 | 14 | Maybe other, but I haven't tested it in other shells. 15 | 16 | ## List of shame 17 | 18 | - Ack 19 | + `$HOME/.ackrc` -> `$XDG_CONFIG_HOME/ack/ackrc` 20 | - Atom 21 | + `$HOME/.atom` -> `$XDG_CONFIG_HOME/atom` 22 | - AWS CLI 23 | + `$HOME/.aws` -> `$XDG_CONFIG_HOME/aws` 24 | - Azure CLI 25 | + `$HOME/.azure` -> `$XDG_DATA_HOME/azure` 26 | - Bundler 27 | + `$HOME/.bundle/config` -> `$XDG_CONFIG_HOME/bundle/config` 28 | + `$HOME/.bundle/cache` -> `$XDG_CACHE_HOME/bundle` 29 | + `$HOME/.bundle/plugin` -> `$XDG_DATA_HOME/bundle/plugin` 30 | - Cargo 31 | + `$HOME/.cargo` -> `$XDG_DATA_HOME/cargo` 32 | - Docker 33 | + `$HOME/.docker` -> `$XDG_CONFIG_HOME/docker` 34 | - Docker Machine 35 | + `$HOME/.docker/machine` -> `$XDG_DATA_HOME/docker/machine` 36 | - GnuPG 37 | + `$HOME/.gnupg` -> `$XDG_CONFIG_HOME/gnupg` 38 | - Hex † 39 | + `$HOME/.hex/hex.config` -> `$XDG_CONFIG_HOME/hex/hex.config` 40 | + `$HOME/.hex/{cache.ets,packages}` -> `$XDG_CACHE_HOME/hex/{cache.ets,packages}` 41 | + `$HOME/.hex/docs` -> `$XDG_DATA_HOME/hex/docs` 42 | - Less 43 | + `$HOME/.lesskey` -> `$XDG_CONFIG_HOME/less/lesskey` 44 | + `$HOME/.lesshst` -> `$XDG_STATE_HOME/less/history` 45 | - Mathematica 46 | + `$HOME/.Mathematica` -> `$XDG_CONFIG_HOME/Mathematica` 47 | - Mix † 48 | + `$HOME/.mix/config.exs` -> `$XDG_CONFIG_HOME/mix/config.exs` 49 | + `$HOME/.mix/{archives,escripts}` -> `$XDG_DATA_HOME/mix` 50 | - Node.js 51 | + `$HOME/.node_repl_history` -> `$XDG_STATE_HOME/node/repl_history` 52 | - NotMuch 53 | + `$HOME/.notmuch-config` -> `$XDG_CONFIG_HOME/notmuch/config` 54 | - NV † 55 | + `$HOME/.nv` -> `$XDG_CACHE_HOME/nv` 56 | - NVM 57 | + `$HOME/.nvm` -> `$XDG_DATA_HOME/nvm` 58 | - Parallel 59 | + `$HOME/.parallel` -> `$XDG_CONFIG_HOME/parallel` 60 | - PostgreSQL 61 | + `$HOME/.psqlrc` -> `$XDG_CONFIG_HOME/postgres/rc` 62 | + `$HOME/.psql_history` -> `$XDG_STATE_HOME/postgres/history` 63 | + `$HOME/.pgpass` -> `$XDG_CONFIG_HOME/postgres/pass` 64 | + `$HOME/.pg_service.conf` -> `$XDG_CONFIG_HOME/postgres/service.conf` 65 | - Readline 66 | + `$HOME/.inputrc` -> `$XDG_CONFIG_HOME/readline/inputrc` 67 | - Rustup 68 | + `$HOME/.rustup` -> `$XDG_DATA_HOME/rustup` 69 | - Vagrant 70 | + `$HOME/.vagrant.d` -> `$XDG_DATA_HOME/vagrant` 71 | - WeeChat 72 | + `$HOME/.weechat` -> `$XDG_CONFIG_HOME/weechat` 73 | 74 | † - it partially uses XDG specs, but fall back to default when XDG variables 75 | aren't present 76 | 77 | This list is not full. If you find something that you are using, please add it 78 | and spread the word. 79 | 80 | ## LICENSE 81 | 82 | [Blue Oak Model License 1.0.0](https://blueoakcouncil.org/license/1.0.0) 83 | -------------------------------------------------------------------------------- /please-use-xdg.sh: -------------------------------------------------------------------------------- 1 | # # Blue Oak Model License 2 | # 3 | # Version 1.0.0 4 | # 5 | # ## Purpose 6 | # 7 | # This license gives everyone as much permission to work with 8 | # this software as possible, while protecting contributors 9 | # from liability. 10 | # 11 | # ## Acceptance 12 | # 13 | # In order to receive this license, you must agree to its 14 | # rules. The rules of this license are both obligations 15 | # under that agreement and conditions to your license. 16 | # You must not do anything with this software that triggers 17 | # a rule that you cannot or will not follow. 18 | # 19 | # ## Copyright 20 | # 21 | # Each contributor licenses you to do everything with this 22 | # software that would otherwise infringe that contributor's 23 | # copyright in it. 24 | # 25 | # ## Notices 26 | # 27 | # You must ensure that everyone who gets a copy of 28 | # any part of this software from you, with or without 29 | # changes, also gets the text of this license or a link to 30 | # . 31 | # 32 | # ## Excuse 33 | # 34 | # If anyone notifies you in writing that you have not 35 | # complied with [Notices](#notices), you can keep your 36 | # license by taking all practical steps to comply within 30 37 | # days after the notice. If you do not do so, your license 38 | # ends immediately. 39 | # 40 | # ## Patent 41 | # 42 | # Each contributor licenses you to do everything with this 43 | # software that would otherwise infringe any patent claims 44 | # they can license or become able to license. 45 | # 46 | # ## Reliability 47 | # 48 | # No contributor can revoke this license. 49 | # 50 | # ## No Liability 51 | # 52 | # ***As far as the law allows, this software comes as is, 53 | # without any warranty or condition, and no contributor 54 | # will be liable to anyone for any damages related to this 55 | # software or this license, under any kind of legal claim.*** 56 | 57 | # Unfortunately some tools will not use XDG directories unless these are set 58 | # 59 | # - Hex 60 | # - Mix 61 | # - NV 62 | [ -z "$XDG_CACHE_HOME" ] && export XDG_CACHE_HOME="$HOME/.cache" 63 | [ -z "$XDG_CONFIG_DIRS" ] && export XDG_CONFIG_DIRS="/etc/xdg" 64 | [ -z "$XDG_CONFIG_HOME" ] && export XDG_CONFIG_HOME="$HOME/.config" 65 | [ -z "$XDG_DATA_DIRS" ] && export XDG_DATA_DIRS="/usr/local/share:/usr/share" 66 | [ -z "$XDG_DATA_HOME" ] && export XDG_DATA_HOME="$HOME/.local/share" 67 | [ -z "$XDG_STATE_HOME" ] && export XDG_STATE_HOME="$HOME/.local/state" 68 | 69 | # Ack 70 | export ACKRC="$XDG_CONFIG_HOME/ack/ackrc" 71 | 72 | # Atom 73 | export ATOM_HOME="$XDG_DATA_HOME/atom" 74 | 75 | # AWS CLI 76 | export AWS_SHARED_CREDENTIALS_FILE="$XDG_CONFIG_HOME/aws/credentials" \ 77 | AWS_CONFIG_FILE="$XDG_CONFIG_HOME/aws/config" 78 | 79 | # Azure CLI 80 | export AZURE_CONFIG_DIR="$XDG_DATA_HOME/azure" 81 | 82 | # Bundler 83 | export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME/bundle" \ 84 | BUNDLE_USER_CACHE="$XDG_CACHE_HOME/bundle" \ 85 | BUNDLE_USER_PLUGIN="$XDG_DATA_HOME/bundle/plugin" 86 | 87 | # Cargo 88 | export CARGO_HOME="$XDG_DATA_HOME/cargo" 89 | 90 | # Docker 91 | export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker" 92 | 93 | # Docker Machine 94 | export MACHINE_STORAGE_PATH="$XDG_DATA_HOME/docker/machine" 95 | 96 | # GnuPG 97 | export GNUPGHOME="$XDG_DATA_HOME/gnupg" 98 | 99 | # Less 100 | export LESSKEY="$XDG_CONFIG_HOME/less/lesskey" \ 101 | LESSHISTFILE="$XDG_STATE_HOME/less/history" 102 | 103 | # Mathematica 104 | export MATHEMATICA_USERBASE="$XDG_CONFIG_HOME/Mathematica" 105 | 106 | # Node.js 107 | export NODE_REPL_HISTORY="$XDG_STATE_HOME/node/repl_history" 108 | 109 | # NotMuch 110 | export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch/config" 111 | 112 | # NVM 113 | export NVM_DIR="$XDG_DATA_HOME/nvm" 114 | 115 | # Parallel 116 | export PARALLEL_HOME="$XDG_CONFIG_HOME/parallel" 117 | 118 | # PostgreSQL 119 | export PSQLRC="$XDG_CONFIG_HOME/postgres/rc" \ 120 | PSQL_HISTORY="$XDG_STATE_HOME/postgres/history" \ 121 | PGPASSFILE="$XDG_CONFIG_HOME/postgres/pass" \ 122 | PGSERVICEFILE="$XDG_CONFIG_HOME/postgres/service.conf" 123 | # We need to create these directories if not exists 124 | mkdir -p "$XDG_CONFIG_HOME/postgres" "$XDG_CONFIG_HOME/postgres" 125 | 126 | # Readline 127 | export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc" 128 | 129 | # Rustup 130 | export RUSTUP_HOME="$XDG_DATA_HOME/rustup" 131 | 132 | # Vagrant 133 | export VAGRANT_HOME="$XDG_DATA_HOME/vagrant" \ 134 | VAGRANT_ALIAS_FILE="$XDG_DATA_HOME/vagrant/aliases" 135 | 136 | # WeeChat 137 | export WEECHAT_HOME="$XDG_CONFIG_HOME/weechat" 138 | --------------------------------------------------------------------------------