Unity Opera!

Unity Opera Tab Count

With Unity in the recent spot light and a little free time on my hands, I decided it was time to dabble with the Launcher API. What better combination that my two favorite pieces of software: Unity in Ubuntu and Opera!

With my Unity Opera script, you’ll be able to get extra functionality for Opera by simply downloading a script and adding it to your Startup Applications list. No technical modifications necessary!

The Launcher API provides four features at the moment: Count, Progress, Urgency, Quicklists.

At the moment I’m only able to implement functionality for three of these, with the exception being Progress. In its current implementation, Unity Opera has the following features:

Count

The total number of tabs you have open appears on the Launcher icon and is updated in real time as you open and close tabs.

One item to note here is that Opera’s Private tabs are not included in this tab count. Since information about these tabs and their contents are not stored anywhere on your computer, Unity Opera has no way of discovering them.

Progress

At this point in time, the progress functionality for this script is not available. Until I find a way to programmatically determine download progress in Opera, I will not be able to implement this.

If you have any information regarding a way to implement this feature then please let me know!

Urgency

When browsing the net, not every link you click on is from inside the web browser. Sometimes you click a link from an instant message, mail client, Gwibber, etc. This is where urgency comes into play.

Typically clicking these links automatically opens the tab in your browser, but it doesn’t always pull you’re browser into focus. When this happens, you may not know which browser the link opened in or if clicking it was even successful.

When Opera is not in focus and a new tab is opened, the Opera icon in the Launcher now enters urgency mode and wiggles onces. An urgency highlight is also applied to the icon and a small attention reminder in the upper left corner until you focus Opera again (this clears the urgency setting).

Quicklists

Previously I shared a tip on how to customize your Quicklists for Opera. That method meant that you had to manually open and edit the desktop file.

This is no longer the case, as these features are already built into Unity Opera.

On top of that, your Speed Dial items are also appended to the Quicklist, making your life that much easier! ;)

If you use Opera’s built in Mail client, also known as M2, then you will see an Opera for Mail, which is intended to open M2 directly. At the moment, this feature doesn’t work as intended, but hopefully in due time it will.

Download Unity Opera

Unity Opera is written in python and can easily be updated and maintained. I suggest you save and extract it to your Home directory and use it there, but you are free to place it anywhere you wish.

Download

Running Unity Opera

You can run Unity Opera in one of two ways:

1. The easiest way in my opinion is to simply add it to your Startup Applications.

To do this simply open your dash and search for ‘Startup Applications‘. Once there, click ‘Add‘ and fill in the blanks!

To run Unity Opera on startup, I place the script in my home folder. You can place it where ever you wish, but if you pick a place other than your home folder then you will need to provide a full path the script in your startup command.

An example of what I use is as follows:

python unity-opera.py

2. The other option is to open a terminal when you want to use this script and run the command above.

Options

This script has several options. For help and more information type:

python unity-opera.py –help

This script accepts two optional args:

1. Opera Channel: This is used for setting Unity Opera to run against regular Opera and the new Opera Next channel. By default, if you exclude this arg, Opera is set as the browser to run against. Examples of this command include:

python unity-opera.py opera

python unity-opera.py opera-next

2. Enable features: This is used to enable specific features. You can enable only basic quicklists [q], quicklists with Speed Dial entries [qs], tab count [c], urgency notification [u], and progress [p].

As mentioned before, progress is not functional at the moment, but I’ve built the script with this feature ready to include as soon as I find a way. ;)

This second argument requires the use of the first argument. Examples of this command include:

python unity-opera.py opera -qs

python unity-opera.py opera-next -qsu

Troubleshooting

If you experience trouble with this script, please try running it from a terminal to see if there are any errors output to the console. If so, copy and paste these in the comments below and I will take a look at them.

Get Your Last.fm Wallpaper From Wallpaperfm

An example from my Last.fm account in Collage mode.

If you have an active Last.fm account and like to switch up your wallpaper from time to time then you’ll love Wallpaperfm!

Example from my Last.fm account in Collage mode.

This python script, by Koant, has been around since at least 2008, but I’ve only recently stumbled across it. It’s easy to start using and is available for Windows, Mac and Linux users!

I’ll help you get started in Linux since that’s what I’ve set it up on. If you need more help or want more configuration options you should look to the information that Koant has posted on his website.

Install

  1. cd
  2. mkdir wallpaperfm
  3. cd wallpaperfm
  4. wget http://ledazibao.free.fr/wallpaperfm/wallpaperfm.py
  5. chmod a+x wallpaperfm.py

Create Your Wallpaper

  1. ./wallpaperfm.py -u YOURLASTFMUSERNAME

That’s the most basic set of options you can use to create your wallpaper (which you will find after running the script in the “wallpaperfm” folder that was created).

There are three options for the type of wallpaper created:

1. Tile

Albums are packed in side by side.

2. Glass

A few albums are highlighted on a glassy surface.

3. Collage

Albums are meshed together in a dreamy design.

To specify one of these modes, simply run the wallpaper script with the mode flag set to your choice.

  • ./wallpaperfm.py -u YOURLASTFMUSERNAME -m collage

There are plenty of other settings you can specify such as size, canvas size, filename, profile period, final opacity, cache, excluded albums, local copy, etc.

Suggestions and Ideas

User Interface and Packaging

I’m sure that this script could be simplified further for Linux users (and more specifically, Debian/Ubuntu users) if a user interface were created. It actually seems like a rather simple task since the parameters for the script are well bounded.

Adding this interface to an installer package would also be a very simple task and would most likely get more attention to such a neat tool!

Cron Jobs, Regularly Updating Your Wallpaper

Another thing, if your music preferences are constantly changing like mine, you may be interested in updating your wallpaper in regular intervals. To do this you can setup a Cron job that runs in the background.

While this may sound difficult and confusing, its really not at all and this helps explain a lot. I can even walk you through the steps.

  1. sudo apt-get install gnome-schedule
  2. Open the application (in Ubuntu) through the Applications menu -> System Tools -> Scheduled tasks.
  3. Click the New button and select the Recurrent task type.
  4. Give the task a description.
  5. Enter the command that runs your script. If you followed the steps above then it should be something similar to:

    /home/YOURUBUNTUNAME/wallpaperfm/wallpaperfm.py -u YOURLASTFMUSERNAME -m collage -f /home/YOURUBUNTUNAME/wallpaperfm/wallpaper

  6. Set the Time & Date option to hourly, daily, weekly, or monthly.
  7. Click the “Add” button to add it to your list of Scheduled Tasks and you’re done!

Have any other suggestions or tips? Leave ‘em in the comments!