Skip to content

Instantly share code, notes, and snippets.

@loukwn
Created February 9, 2019 20:39
Show Gist options
  • Save loukwn/49fe3d9c4a809acb2a66c9b0af20029b to your computer and use it in GitHub Desktop.
Save loukwn/49fe3d9c4a809acb2a66c9b0af20029b to your computer and use it in GitHub Desktop.
Install a gnome shell extension from a zip
#!/bin/bash
username=$(whoami)
if [[ $# -eq 0 ]]; then
echo "No arguments supplied"
else
# get the extension uuid
ext_name=$(unzip -c $1 metadata.json | grep uuid | cut -d \" -f4)
# check if it already exists
search_ext=$(ls /home/$username/.local/share/gnome-shell/extensions/ | grep "$ext_name")
if [[ "$ext_name" == "$search_ext" ]]; then
echo "$ext_name : Already installed"
else
if [[ ! -z "$ext_name" ]]; then
# create the folder in /
mkdir -p "/home/$username/.local/share/gnome-shell/extensions/$ext_name"
# unzip everything inside
unzip -q $1 -d "/home/$username/.local/share/gnome-shell/extensions/$ext_name/"
# install the extension
gnome-shell-extension-tool -e $ext_name
else
# error
echo "Wrong type of input"
fi
fi
fi
Copy link

ghost commented Feb 9, 2019

Nice script!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment