From 2582fa9e97c1484640e9ff40b63dac0964bb0362 Mon Sep 17 00:00:00 2001 From: pvincent Date: Sat, 27 Mar 2021 00:42:00 +0400 Subject: [PATCH] python gnome-extension-cli --- src/main | 92 ++++++++++++++++---------------------------------------- 1 file changed, 26 insertions(+), 66 deletions(-) diff --git a/src/main b/src/main index c27c93d..858a6ae 100755 --- a/src/main +++ b/src/main @@ -34,7 +34,6 @@ function askConfirmation (){ # variables and constants BASEDIR=/opt/debian-gnome -LOGOUT_REQUIRED=false GIT_REPOSITORY_RAW="https://git.artcode.re/pvincent/debian-gnome/raw/master" ALLOWED_USERS=$(id -un) #CUSTOMIZE if needed! REQUIRED_PACKAGES=( git wget curl htop tilix jq unzip ) @@ -126,77 +125,38 @@ if [[ "$favorite_apps" == "['firefox-esr.desktop', 'org.gnome.Evolution.desktop' gsettings set org.gnome.shell favorite-apps "['org.gnome.Nautilus.desktop','firefox-stable.desktop','org.gnome.Software.desktop']" fi -## gnome extension system-monitor -runVoid dpkg-query --status gnome-shell-extension-system-monitor -if [ $? -ne 0 ] ; then - set -e - sudo apt install gnome-shell-extension-system-monitor - LOGOUT_REQUIRED=true - sudo cp /usr/share/gnome-shell/extensions/system-monitor@paradoxxx.zero.gmail.com/schemas/*.gschema.xml /usr/share/glib-2.0/schemas/ - sudo glib-compile-schemas /usr/share/glib-2.0/schemas/ - gnome-shell-extension-tool -e system-monitor@paradoxxx.zero.gmail.com - gnome-shell-extension-tool -r system-monitor@paradoxxx.zero.gmail.com - set +e - - gsettings set org.gnome.shell.extensions.system-monitor show-tooltip true - gsettings set org.gnome.shell.extensions.system-monitor cpu-show-text false - gsettings set org.gnome.shell.extensions.system-monitor cpu-graph-width 60 - gsettings set org.gnome.shell.extensions.system-monitor memory-display false - gsettings set org.gnome.shell.extensions.system-monitor net-display true - gsettings set org.gnome.shell.extensions.system-monitor net-style digit - gsettings set org.gnome.shell.extensions.system-monitor net-show-text false - gsettings set org.gnome.shell.extensions.system-monitor icon-display false - gsettings set org.gnome.shell.extensions.system-monitor disk-display false +## gnome-extensions-cli +command gnome-extensions-cli 2> /dev/null +if [[ $? -ne 0 ]]; then + sudo pip3 install --user gnome-extensions-cli else - echo "gnome-shell-extension-system-monitor already installed!" -fi - -## gnome extension appindicator -UUID=appindicatorsupport@rgcjonas.gmail.com -if [[ ! -d "$HOME/.local/share/gnome-shell/extensions/$UUID" ]]; then - wget -q https://extensions.gnome.org/extension-data/appindicatorsupportrgcjonas.gmail.com.v26.shell-extension.zip -O /tmp/appindicator.zip - mkdir -p "$HOME/.local/share/gnome-shell/extensions/$UUID" - unzip -q /tmp/appindicator.zip -d "$HOME/.local/share/gnome-shell/extensions/$UUID" - gnome-shell-extension-tool -e "$UUID" - gnome-shell-extension-tool -r "$UUID" - LOGOUT_REQUIRED=true -else - echo "gnome-shell-extension-appindicator already installed!" + echo "gnome-extensions-cli already installed!" fi -## install-gnome-extensions.sh -FILE_IGE="${BASEDIR}/tools/install-gnome-extensions.sh" -if [[ ! -f "$FILE_IGE" ]]; then - sudo mkdir -p "${BASEDIR}/tools" - sudo chown $(id -un) "${BASEDIR}/tools" - wget -N -q "https://raw.githubusercontent.com/cyfrost/install-gnome-extensions/master/install-gnome-extensions.sh" -O $FILE_IGE - chmod +x $FILE_IGE -else - echo "install-gnome-extensions.sh already installed!" -fi - -# install extension with install-gnome-extensions.sh -declare -A extensions=( - [104]="netspeed@hedayaty.gmail.com" - [120]="places-menu@gnome-shell-extensions.gcampax.github.com" +## gnome extension system-monitor +EXTENSIONS=( + "appindicatorsupport@rgcjonas.gmail.com" + "system-monitor@paradoxxx.zero.gmail.com" + "netspeed@hedayaty.gmail.com" ) -for key in "${!extensions[@]}"; do - value="${extensions[$key]}" - if [[ ! -d "$HOME/.local/share/gnome-shell/extensions/${value}" ]]; then - echo -n "installing new extension <${value}>..." - $FILE_IGE --enable $key - echo DONE - gnome-shell-extension-tool -e "$value" + +for extension in "${EXTENSIONS[@]}"; do + if [[ ! -d $HOME/.local/share/gnome-shell/extensions/$extension ]];then + gnome-extensions-cli install $extension else - echo "Extension <${value}> already installed!" + echo "extension <${extension}> already installed!" fi done -## logout required -if [[ $LOGOUT_REQUIRED == true ]];then - echo - echo "****************************************************************" - echo "please consider logging out, then log in again to apply changes!" - echo "****************************************************************" -fi +# gsettings +gsettings set org.gnome.shell.extensions.system-monitor show-tooltip true +gsettings set org.gnome.shell.extensions.system-monitor cpu-show-text false +gsettings set org.gnome.shell.extensions.system-monitor cpu-graph-width 60 +gsettings set org.gnome.shell.extensions.system-monitor memory-display false +gsettings set org.gnome.shell.extensions.system-monitor net-display true +gsettings set org.gnome.shell.extensions.system-monitor net-style digit +gsettings set org.gnome.shell.extensions.system-monitor net-show-text false +gsettings set org.gnome.shell.extensions.system-monitor icon-display false +gsettings set org.gnome.shell.extensions.system-monitor disk-display false +