From 71baf34d581cb0f2e49ff21af46836127dc6552b Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Mon, 10 Apr 2023 17:46:20 +0200 Subject: [PATCH] Move ~/.dotfiles to $XDG_DATA_HOME/dotfiles --- .config/shell/aliases.d/generic.sh | 2 +- .config/shell/init_dotfiles.sh | 6 +++--- .config/shell/utils.d/update.sh | 12 ++++++------ README.md | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.config/shell/aliases.d/generic.sh b/.config/shell/aliases.d/generic.sh index 7b365be..28ea6b4 100644 --- a/.config/shell/aliases.d/generic.sh +++ b/.config/shell/aliases.d/generic.sh @@ -39,7 +39,7 @@ alias help='man' # Various one-line utilities alias datetime='date +"%Y-%m-%d %H:%M:%S %z (%Z)"' alias datetime-iso='date --iso-8601=seconds' -alias dotfiles='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME' +alias dotfiles='git --git-dir=$XDG_DATA_HOME/dotfiles/ --work-tree=$HOME' alias external-ip="curl https://icanhazip.com" alias external-ip-alt="curl https://ipinfo.io/ip\?token=cfd78a97e15ebf && echo" alias external-ip-extended-infos="curl https://ipinfo.io/json\?token=cfd78a97e15ebf && echo" diff --git a/.config/shell/init_dotfiles.sh b/.config/shell/init_dotfiles.sh index fe27222..b7d2fd6 100755 --- a/.config/shell/init_dotfiles.sh +++ b/.config/shell/init_dotfiles.sh @@ -13,9 +13,9 @@ _command_exists() { cd $HOME -# Get the latest ~/.dotfiles, possibly replacing the old ones -rm -rf "$HOME/.dotfiles" >/dev/null -git clone --bare https://code.webartifex.biz/alexander/dotfiles.git "$HOME/.dotfiles" +# Get the latest $XDG_DATA_HOME/dotfiles, possibly replacing the old ones +rm -rf "$XDG_DATA_HOME/dotfiles" >/dev/null +git clone --bare https://code.webartifex.biz/alexander/dotfiles.git "$XDG_DATA_HOME/dotfiles" # Distribute the dotfiles in $HOME git --git-dir=$XDG_DATA_HOME/dotfiles/ --work-tree=$HOME checkout --force diff --git a/.config/shell/utils.d/update.sh b/.config/shell/utils.d/update.sh index 5d4fb5e..dc1c498 100644 --- a/.config/shell/utils.d/update.sh +++ b/.config/shell/utils.d/update.sh @@ -63,15 +63,15 @@ _update_repositories() { cd $cwd } -# Update the ~/.dotfiles repository +# Update the $XDG_DATA_HOME/dotfiles repository _update_dotfiles() { - echo "Fetching $HOME/.dotfiles" + echo "Fetching $XDG_DATA_HOME/dotfiles" # The `dotfiles` alias is defined in ~/.bashrc at the end of the # "Shell Utilities & Aliases" section and can NOT be used here - git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME stash --quiet - git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME fetch --all --prune - git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME pull --rebase --quiet - git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME stash pop # --quiet is ignored + git --git-dir=$XDG_DATA_HOME/dotfiles/ --work-tree=$HOME stash --quiet + git --git-dir=$XDG_DATA_HOME/dotfiles/ --work-tree=$HOME fetch --all --prune + git --git-dir=$XDG_DATA_HOME/dotfiles/ --work-tree=$HOME pull --rebase --quiet + git --git-dir=$XDG_DATA_HOME/dotfiles/ --work-tree=$HOME stash pop # --quiet is ignored } diff --git a/README.md b/README.md index c6bcf63..b2b69ba 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ curl https://code.webartifex.biz/alexander/dotfiles/-/raw/main/.config/shell/ini ``` This gives you a local copy of the latest version of this repository - (located in `~/.dotfiles`) + (located in `$XDG_DATA_HOME/dotfiles`) and initializes all the dotfiles provided here on the system. Further, `zsh` is set up with [`oh-my-zsh`](https://ohmyz.sh/) and [`zplug`](https://github.com/zplug/zplug)