Last active
April 11, 2024 09:12
-
-
Save BoQsc/3dc2c74578c34a62b63995e2ecb8cf15 to your computer and use it in GitHub Desktop.
Download and Install multiple latest Gnome extensions via Bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
declare gnomeExtensionsList=( | |
#"[email protected]" # Dash to Dock | |
"[email protected]" # Dash to Panel | |
"[email protected]" # Desktop Icons NG - introduces a working Drag N Drop for Desktop Icons | |
) | |
function installExtensions(){ | |
declare host="https://extensions.gnome.org/download-extension" | |
for extensionUUID in "${gnomeExtensionsList[@]}"; do | |
wget "$host/$extensionUUID.shell-extension.zip?shell_version=9.99.9" -O "$extensionUUID-latest.zip" | |
gnome-extensions install "$extensionUUID-latest.zip" | |
gnome-extensions enable "$extensionUUID" | |
rm "$extensionUUID-latest.zip" | |
done | |
tweakExtensions; | |
busctl --user call org.gnome.Shell /org/gnome/Shell org.gnome.Shell Eval s 'Meta.restart("Restarting…")' | |
} | |
function tweakExtensions(){ | |
for extensionUUID in "${gnomeExtensionsList[@]}"; do | |
# Desktop NG Extension | |
if [ "$extensionUUID" == "[email protected]" ] ; then | |
# Disable Original Desktop Icons, since Desktop Icons NG is better at Drag N Drop | |
gnome-extensions disable "desktop-icons@csoriano" | |
fi | |
# Dash to Panel Enhancements | |
#if [ "$extensionUUID" == "[email protected]" ] ; then | |
# gschemes cannot be installed via Extensions alone. So there are no way to modify settings via command line | |
# unless we manually compile schemas via command line. | |
# /org/gnome/shell/extensions/dash-to-panel/ | |
#sudo cp /home/vaidas/.local/share/gnome-shell/extensions/[email protected]/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml /usr/share/glib-2.0/schemas/ && | |
#sudo glib-compile-schemas /usr/share/glib-2.0/schemas/ | |
# gsettings set org.gnome.shell.extensions.dash-to-panel panel-size 46 | |
# gsettings set org.gnome.shell.extensions.dash-to-panel appicon-padding 5 | |
# gsettings set org.gnome.shell.extensions.dash-to-panel window-preview-size 150 | |
# gsettings --schemadir "$HOME/.local/share/gnome-shell/extensions/[email protected]/schemas" set org.gnome.shell.extensions.ding icon-size "small" | |
#fi | |
# mkdir "/usr/share/gnome-shell/extensions/disabled" | |
# sudo mv /usr/share/gnome-shell/extensions/* "/usr/share/gnome-shell/extensions/disabled" | |
done | |
} | |
function removeExtensions(){ | |
for extensionUUID in "${gnomeExtensionsList[@]}"; do | |
gnome-extensions uninstall "$extensionUUID"; | |
done | |
cleanupExtensions; | |
busctl --user call org.gnome.Shell /org/gnome/Shell org.gnome.Shell Eval s 'Meta.restart("Restarting…")' | |
} | |
function cleanupExtensions(){ | |
# Dash to Dock Extension | |
# After Dash to Dock is uninstalled, Ubuntu dock is not re-enabled, we have to do that manually | |
gnome-extensions enable "[email protected]"; | |
# Desktop NG Extension | |
# Re-enable since Desktop Icons NG is being uninstalled | |
gnome-extensions enable "desktop-icons@csoriano"; | |
} | |
# Command Line interface | |
declare argument0=$0; | |
declare argument1=$1; | |
if [ "$argument1" = "" ]; | |
then | |
echo " ____________Extensions will be installed____________" | |
for extensionUUID in "${gnomeExtensionsList[@]}"; do | |
echo " $extensionUUID"; | |
done | |
echo " ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾" | |
echo Please select to install or remove extensions | |
echo " \"$argument0\" install" | |
echo " \"$argument0\" remove" | |
else | |
if [ "$argument1" = "install" ]; | |
then | |
installExtensions; | |
fi | |
if [ "$argument1" = "remove" ]; | |
then | |
removeExtensions; | |
fi | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment