Add load/push-extensions for gnome

This commit is contained in:
Sage Vaillancourt 2024-02-24 12:16:49 -05:00
parent 5a7057a9bb
commit 14b3872e32
1 changed files with 37 additions and 3 deletions

View File

@ -109,21 +109,53 @@ function push-dconf {
echo "An alias for scpace has not been defined on this device!"
return 1
fi
rm /tmp/dconf-dump &> /dev/null
dconf-dump > /tmp/dconf-dump || return 1
scp -P 11275 /tmp/dconf-dump 'sage@sagev.space:~/dconf-dump'
}
function push-extensions {
if ! command -v gnome-extensions &> /dev/null; then
echo "gnome-extensions is not installed!"
return
fi
gnome-extensions list > /tmp/gnome-extension-list
scp -P 11275 /tmp/gnome-extension-list 'sage@sagev.space:~/gnome-extension-list'
}
function load-extensions {
if ! command -v gnome-extensions &> /dev/null; then
echo "gnome-extensions is not installed!"
return
fi
local existing="$(gnome-extensions list)"
for ext in $(cat /tmp/gnome-extension-list); do
if grep "$ext" <(echo $existing) &> /dev/null; then
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"
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}
fi
gnome-extensions enable ${ext}
rm ${EXTENSION_ID}.zip
done
}
function pushdot {
cd "$DOT_DIR" || return 1
local res
if [ $# -eq 0 ]; then
git commit -a && git push -u origin main && push-dconf
git commit -a
res="$?"
else
git commit -a -m "$@" && git push -u origin main && push-dconf
git commit -a -m "$@"
res="$?"
fi
if [[ "$res" == "0" ]]; then
git push -u origin main && push-extensions && push-dconf
fi
cd -
return $res
}
@ -136,6 +168,8 @@ function getdot {
cd "$DOT_DIR" || return 1
git pull && ./copy.sh
rm /tmp/dconf-dump &> /dev/null
scp -P 11275 'sage@sagev.space:~/gnome-extension-list' /tmp/gnome-extension-list
load-extensions
scp -P 11275 'sage@sagev.space:~/dconf-dump' /tmp/dconf-dump
dconf-dump > /tmp/current-dconf-dump
if ! git --no-pager diff --no-index /tmp/current-dconf-dump /tmp/dconf-dump &> /dev/null; then