From b0bc85b327f998f679984545666305654b46d150 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Sat, 24 Feb 2024 13:36:19 -0500 Subject: [PATCH] Add sync-history --- fake_home/.zshrc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/fake_home/.zshrc b/fake_home/.zshrc index 7208c10..6832ceb 100644 --- a/fake_home/.zshrc +++ b/fake_home/.zshrc @@ -127,6 +127,17 @@ function push-extensions { scp -P 11275 /tmp/gnome-extension-list 'sage@sagev.space:~/gnome-extension-list' } +function merge-hist { + \diff --unified=9999999999999999 "$1" "$2" | tail -n +4 | sed 's/^.//' +} + +function sync-history { + scp -P 11275 'sage@sagev.space:~/histfile' "/tmp/.histfile" + merge-hist "$HOME/.histfile" "/tmp/.histfile" > "/tmp/$(whoami).histfile" + mv "/tmp/$(whoami).histfile" "$HOME/.histfile" + scp -P 11275 "$HOME/.histfile" "/tmp/$(whoami).histfile" +} + function load-extensions { if ! command -v gnome-extensions &> /dev/null; then echo "gnome-extensions is not installed!" @@ -139,7 +150,7 @@ function load-extensions { continue fi VERSION_TAG=$(curl -Lfs "https://extensions.gnome.org/extension-query/?search=${ext}" | jq '.extensions[0] | .shell_version_map | map(.pk) | max') - wget -O ${ext}.zip "https://extensions.gnome.org/download-extension/${ext}.shell-extension.zip?version_tag=$VERSION_TAG" + wget -O ${ext}.zip "https://extensions.gnome.org/download-extension/${ext}.shell-extension.zip?version_tag=$VERSION_TAG" || continue gnome-extensions install --force ${EXTENSION_ID}.zip if ! gnome-extensions list | grep --quiet ${ext}; then busctl --user call org.gnome.Shell.Extensions /org/gnome/Shell/Extensions org.gnome.Shell.Extensions InstallRemoteExtension s ${ext} @@ -160,7 +171,7 @@ function pushdot { res="$?" fi if [[ "$res" == "0" ]]; then - git push -u origin main && push-extensions && push-dconf + git push -u origin main && push-extensions && sync-history && push-dconf fi cd - return $res @@ -173,7 +184,10 @@ function getdot { fi cd "$DOT_DIR" || return 1 git pull && ./copy.sh + load-extensions + sync-history + rm /tmp/dconf-dump &> /dev/null scp -P 11275 'sage@sagev.space:~/dconf-dump' /tmp/dconf-dump dconf-dump > /tmp/current-dconf-dump