You Got A Question? Ask    GNOME Community!


HowTo print a nice list of your installed Gnome Shell Extensions

This post was made with an older stylesheet


Print a nice list of your installed extensions

This is totally cool if you want to share the extension you are using with the rest of the people in a blog or in a forum. Daniel shared this on Forums (thanks).

extensions-list-script

It takes some time to load, and if you close the window with <Ctrl+C> as I usually do, it won’t wipe the temp.txt file, so next time it will append in the previous (it will just show your extensions twice).


The Script

You can find it at GitHub and this is how it looks for now. It needs some improvements and if you want to give some feedback ..is welcome :)

#!/bin/bash

#We want the new-line to remain
old_ifs=${IFS}
IFS=$'
'

#Get the names of the extensions
EXT=$(grep "name\":" ~/.local/share/gnome-shell/extensions/*/metadata.json /usr/share/gnome-shell/extensions/*/metadata.json | awk -F '"name": "|",' '{print $2}')

echo "[Looking up extensions...]"
echo

#Find urls to the extensions
for n in ${EXT};
do
EXTFIND=$(grep -l "${n}" ~/.local/share/gnome-shell/extensions/*/metadata.json /usr/share/gnome-shell/extensions/*/metadata.json)

#Curl don't like blank spaces so use %20
i=$(echo "${n}" | sed 's/ /%20/g')

URL=$(curl -A 'Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20100101 Firefox/17.0' --silent "https://www.google.com/search?q=site:extensions.gnome.org%20${i}" | grep -io "<a href=\"https://extensions.gnome.org/extension/.*(this,'','','','1'," | awk -F '<a href="|"*' '{print $2}')

#If urls not on extensions.gnome.org use the one in metadata.json
if [ "${URL}" = "" ]; then
URL=$(grep "url\":" ${EXTFIND} | awk -F '"url": "|",*' '{print $2}')
fi

#Print out the nice list
echo "$n - (${URL})" >> temp.txt
done

zenity --text-info --width=850 --height=800 --title="My extensions" --filename=temp.txt
rm temp.txt

echo
echo "[Done!]"

IFS=${old_ifs}
You might need to clear your cache (3xCtrl+F5) to see the above code in a pretty format ;)

How to Run it

If you are not familiar with Git and not sure how to use this script:

1. Copy all the text in gnomeExtGet

2. Open terminal, make a new file and paste text there

$ gedit gnomeExtGet

3. Make the file executable

$ chmod +x gnomeExtGet

4. Run it

$ ./gnomeExtGet

Get it @ https://github.com/Almehdi/gnomeExtGet/blob/master/gnomeExtGet


 
  We can't watch comments unless G+ provides an API or if you send a notification, e.g +World Of Gnome
     Sometimes is better to place your questions on GNOME Community
  • Daniel Sandman

    Hey Alex, I have updated the script a bit.. It will now only fetch url’s for
    extensions it doesn’t have listed since before. So it will finish a lot quicker after the
    first fetch.

    I was wondering
    how you got that bug in the screen shot. I think
    it might have been because you pressed ctrl+c prematurely and the script
    didn’t finish. You shouldn’t need to do that. It should finish without
    ctrl+c.

    I have therefore added a progress indicator in this new version..

  • Pingback: Links 29/12/2012: Calculate Linux 13, Finnix 107 | Techrights