Shopping lens for Gnome Shell
The shopping lens in Unity has been one of the most talked about features, not always in a good way. Personally I quite like it, I have purchased several items through it and it seems to be a faster experience at simply finding stuff than using Amazon itself. Producing a lens that makes money clearly caused a lot of people to look up and examine the situation in more depth and it was then discovered that it should have been using https for the transport and issues around privacy and sending search terms off the local machine were raised. All valid issues which have been addressed to a greater or lesser extent, but it got me thinking about privacy  and prompted me to have a play with Gnome Shell and in due course prompted me to look into Gnome Shell extensions.
You can do cool things with Gnome Shell extensions, they are written in Javascript and can manipulate the user interface in quite flexible ways. One particular type of extension is the search provider – which corresponds pretty well to the Unity lens. There are search providers for wikipedia, virtualbox, ssh and a few other searchable things and today my shopping search provider for Amazon was approved and published.
In simple terms to get the thing running visit the extension page using chromium or a supported version of Firefox whilst running Gnome Shell. This should give you a slider on the left that you can use to activate the extension, this will download and install it in ~/.local/share/gnome-shell/extensions/shopping@libertus.co.uk (that looks like an email address, but it isn’t). Once installed you can hit the settings icon on that very same web page to configure the extension – or just hit super and type “a toaster” to search for “toaster” on Amazon (“a” is the default search prefix to tell it you want to do an Amazon search)
Configuring it looks like this:
If you set the keyword to blank then it will function like the Unity shopping lens does – it searches as you type for everything you type. I kind of like the prefix, I know when I want to search on Amazon and when I don’t actively want to do that I am not interested in the performance hit of a redundant search, but you can make up your own mind about that.
The shop domain is the bit after www.amazon and it can be any one of:
- co.uk
- de
- com
- ca
- fr
- co.jp
- it
- cn
- es
Different stores return different products and prices and descriptions.
The affiliate code can be set to anything, gnomestore-20 will give money to Gnome as you shop, electronicfro-20 will give money to the EFF, and leaving it as theopesou-21 will give money to the LBF (Libertus Beer Fund).
Why this is not very evil
- The user is given control over the affiliate code
- It is opt-in for each user of the machine as it is installed in the user home directory.
- There is a user controllable keyword prefix for searching
- It uses https for transport client to server and server to Amazon
- The client side is fully open source
- I am being transparent about how it works
- It does not use geoIP to decide what Amazon store to use, it does not pass your IP address to Amazon or anywhere else.
- I am not interested in logging searches or IP addresses, I plan to monitor logs for a few days to check it is working OK for people then turn off logging altogether for the server.
- Enabling this does not require you to enable other online search providers, they are not co-dependent.
Why it is a little bit evil
- The server side is not in the control of the user –
or published source (it is about 5 lines of code, but includes secret API keys)it is now published in the repository with the client side code, the API keys are in a separate file. - It uses my affiliate ID as a default
- It is sending search queries off the local machine – and has the capacity to log or do evil with all queries typed into the search box (check the code to make sure it doesn’t. The code starts executing on every single keystroke, but it gives up if the regular expression with the keyword doesn’t match what you typed).
- It gets pictures from Amazon and they could data mine the logs for those and indirectly track your searches that way (highly unlikely – they track you in much more useful ways as soon as you click through to anything you are interested in. Image logs have little informational value.)
- It advocates for a materialistic society based on the existential nihilism of unfettered consumerism
How it could be less evil
- If someone wants to fork it and run a server on behalf of some foundation that is considered less evil than me then feel free to do so, it is GPLv2 code. What I don’t want you to do is fork the extension and change the default affiliate ID but keep it pointing at my server by default as a back end.
- You could run your own local search provider and register for your own API keys if you want to trust nobody but yourself and Amazon. I don’t think you can earn money purchasing items yourself on your own affiliate code so don’t think there is a magical discount facility waiting for you to set it up.
Future enhancements
I would like to make the store list  a dropdown selection – maybe auto selected based on locale or something. It would be good to provide a list of common affiliate IDs for charities and organisations that people might want to support, but I want to retain the ability for a user to type in one of their own choosing. Maybe it could take a list of affiliate IDs that it uses at random. If you have suggestions then do leave a comment, or fork it on github https://github.com/AlanBell/shopping-search-provider
Happy shopping (it is the reason for the season) and have a happy new year!
> It would be good to provide a list of common affiliate IDs for charities and organisations that people might want to support, but I want to retain the ability for a user to type in one of their own choosing.
There’s http://developer.gnome.org/gtk3/stable/GtkComboBoxText.html#gtk-combo-box-text-new-with-entry.
cool, thanks for the pointer on that I will try and add that in the next version.
[…] Before you use this, I strongly reckon to read: http://www.theopensourcerer.com/2012/12/shopping-lens-for-gnome-shell/ […]
Exposing millisecond and pixel settings are not good user interface design. http://www106.pair.com/rhp/free-software-ui.html
That is a fair point and I think that bit will evolve. The thing is I don’t know what is “right” for all screen sizes, computer speeds, internet connection speeds so I am leaving in some flexibility for tuning. I will probably prune some settings at some point, perhaps when it is a bit more responsive to screen sizes.
Total rubbish. Millisecond and pixel settings are awesome and let me actually set it up how I want it to look. Like the defaults? Then leave them as defaults and don’t worry about it.
If you must change it, put it under an advanced menu – but reducing customization is an awful idea. Don’t cater to people who are so ADD they can’t deal with an extra text field.
Well there is a balance between things that should be exposed as preferences, things that should be in advanced area and things that might as well be in the code because people can change the code if they want to. It would probably be better to have a setting for the number of columns rather than a pixel width and probably a setting to hide the descriptions to get loads of result images on a page which can then be expanded or something like the unity previews. There are different ways of doing things and this probably isn’t fully settled yet.
The great thing of the internet is that even for the biggest fail there is out there someone who likes it.
The great thing about open source is that even this could be ported.
I love that comment!
Dog on five legs. Who needs it?
Won’t install for me in gnome-shell 3.4.1
yeah, sorry about that. The metadata is set to 3.6.2 minimum because that is what it was developed on (Ubuntu 12.10) I haven’t tested it on other versions yet, I am not sure if it will work right with gsettings preferences. If you are feeling up for a challenge you can edit ~/.local/share/gnome-shell/extensions/shopping@libertus.co.uk/metadata.json and change that to 3.4 (that is if it installed and didn’t start – if it really didn’t install then grab the code from github) and let me know if it does actually run and that you can change the preferences and those changes have an effect and survive restarts of the shell.
No, simply changing metadata.json didn’t work.
OK, well I guess I will leave it supporting 3.6.2 and above then unless I get time to install an old version of Ubuntu in a VM at some point to figure out what is up with it. There were some fairly important changes between 3.4 and 3.6 so I might not be able to get it working.
My extension works with 3.4 and 3.6, there’s no reason for your version does not work with 3.4.
OK, I will install 3.4 in a VM and figure out what is going on with it.
Thanks for writing the Wikipedia search provider!
[…] desenvolvedor do Gnome criou uma extensão para o Gnome Shell que permite os usuários fazer buscas de produtos para […]