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.

31 thoughts on “Unity Opera!”

  1. Opera 11.10 Opera 11.10 Windows 7 Windows 7
    Opera/9.80 (Windows NT 6.1; U; en) Presto/2.8.131 Version/11.10

    Once Unity isn’t as much a pain to use, I’ll be sure to try it 😉

    1. Opera Next 11.50 Opera Next 11.50 Ubuntu 11.04 x64 Ubuntu 11.04 x64
      Opera/9.80 (X11; Linux x86_64; U; Opera Next; Ubuntu/11.04 (natty); en) Presto/2.8.131 Version/11.50

      sweet!

  2. Google Chrome 11.0.696.65 Google Chrome 11.0.696.65 Mac OS X  10.6.7 Mac OS X 10.6.7
    Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.65 Safari/534.24

    😮

  3. Opera 11.10 Opera 11.10 GNU/Linux GNU/Linux
    Opera/9.80 (X11; Linux i686; U; en) Presto/2.8.131 Version/11.10

    This is sweet! Nice work indeed.

  4. Opera 11.10 Opera 11.10 GNU/Linux x64 GNU/Linux x64
    Opera/9.80 (X11; Linux x86_64; U; ru) Presto/2.8.131 Version/11.10

    python unity-opera.py
    ERROR:root:Could not find any typelib for Unity
    ERROR:root:Could not find any typelib for Dbusmenu
    Traceback (most recent call last):
    File “unity-opera.py”, line 12, in
    from gi.repository import Unity, Gio, GObject, Dbusmenu
    ImportError: cannot import name Unity

    1. Opera Next 11.50 Opera Next 11.50 Ubuntu 11.04 x64 Ubuntu 11.04 x64
      Opera/9.80 (X11; Linux x86_64; U; Opera Next; Ubuntu/11.04 (natty); en) Presto/2.8.131 Version/11.50

      Can you open Synaptic and make sure that you have the following package installed?

      gir1.2-unity-3.0

      1. Opera 11.10 Opera 11.10 GNU/Linux x64 GNU/Linux x64
        Opera/9.80 (X11; Linux x86_64; U; ru) Presto/2.8.131 Version/11.10

        Thanks! Now it works! I think this package should be mentioned in article.

        1. Opera Next 11.50 Opera Next 11.50 Ubuntu 11.04 x64 Ubuntu 11.04 x64
          Opera/9.80 (X11; Linux x86_64; U; Opera Next; Ubuntu/11.04 (natty); en) Presto/2.8.131 Version/11.50

          I’m not sure what happened for your installation of Ubuntu, but it was installed by default for me.

          Glad its working!

          1. Opera 11.10 Opera 11.10 GNU/Linux x64 GNU/Linux x64
            Opera/9.80 (X11; Linux x86_64; U; ru) Presto/2.8.131 Version/11.10

            It was fresh install

  5. Chromium 11.0.696.57 Chromium 11.0.696.57 Ubuntu 11.04 Ubuntu 11.04
    Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Ubuntu/11.04 Chromium/11.0.696.57 Chrome/11.0.696.57 Safari/534.24

    hi,I’m a chinese linuxer.
    Can I upload the file to chinese netdisk?

    1. Opera Next 11.50 Opera Next 11.50 Ubuntu 11.04 x64 Ubuntu 11.04 x64
      Opera/9.80 (X11; Linux x86_64; U; Opera Next; Ubuntu/11.04 (natty); en) Presto/2.8.131 Version/11.50

      Sure

  6. Opera 11.10 Opera 11.10 GNU/Linux GNU/Linux
    Opera/9.80 (X11; Linux i686; U; en) Presto/2.8.131 Version/11.10

    I have a fresh install of ubuntu 11.04 and I am trying to set opera 11.10 as my default browser I’ve tried with preferred applications but it does not give me any option other than firefox. I have also looked at opera->menu->settings->preferences and I cannot see an option there to set opera as the default browser either. Is there any way to set Opera 11.10 as the default browser in ubuntu natty nawhal 11.04?

  7. Opera 11.10 Opera 11.10 GNU/Linux x64 GNU/Linux x64
    Opera/9.80 (X11; Linux x86_64; U; en-GB) Presto/2.8.131 Version/11.10

    Regarding count, would not it be better to count messages in M2? I personally never cared how many tabs I have opened (and I think it clutters the interface a bit) but e-mails would be useful.

    1. Opera Next 11.50 Opera Next 11.50 Ubuntu 11.04 x64 Ubuntu 11.04 x64
      Opera/9.80 (X11; Linux x86_64; U; Opera Next; Ubuntu/11.04 (natty); en) Presto/2.8.131 Version/11.50

      I don’t yet have the functionality for M2 completed. Once I complete this I’m going to add an option. I’d say the vast majority of Opera users do not use M2 so I will likely keep tab count as the default count, but as you see above I’ve already added several options and this will be one as well. 🙂

  8. Opera 11.10 Opera 11.10 GNU/Linux GNU/Linux
    Opera/9.80 (X11; Linux i686; U; en) Presto/2.8.131 Version/11.10

    For me too the tab count is quite useless. Otherwise I love it, thank you very much!

    1. Opera Next 11.50 Opera Next 11.50 Ubuntu 11.04 x64 Ubuntu 11.04 x64
      Opera/9.80 (X11; Linux x86_64; U; Opera Next; Ubuntu/11.04 (natty); en) Presto/2.8.131 Version/11.50

      you can always run it with args and leave out the tab count. Thats why I added these options (as mentioned in the post).

      Here’s an example of what you want:

      python unity-opera.py opera -qsu

  9. Opera 11.10 Opera 11.10 GNU/Linux GNU/Linux
    Opera/9.80 (X11; Linux i686; U; de) Presto/2.8.131 Version/11.10

    Nice. Looks quite useful.

    Do you plan to set up a project site/source code repository for it? Like on launchpad or something? Might be nice so people could share ideas and code.

    Feature-wise, I think the tab count is not the best use of the counter. The counter normally should display items one should act upon (like unread emails) and/or are temporarily of interest (like active downloads). Personally, I’d think the loaded-but-unvisited tabs (those with the small dot on them in Opera) would be worth displaying in the count, but not all tabs. Chromium and Firefox count active downloads, so this might be a good idea for consistency’s sake (although probably difficult to implement?).

    Code-wise, I think some things could be solved more elegantly, like making use of the stdlib for some things. E.g., using OptionParser for commandline options could simplify things, and maybe even ConfigParser could be used for parsing the .ini file.

    But these are small areas for improvement, the script is already good!

  10. Opera 11.10 Opera 11.10 GNU/Linux x64 GNU/Linux x64
    Opera/9.80 (X11; Linux x86_64; U; en) Presto/2.8.131 Version/11.10

    add #!/usr/bin/python to the top of the script

  11. Opera Next 11.50 Opera Next 11.50 Ubuntu 11.04 x64 Ubuntu 11.04 x64
    Opera/9.80 (X11; Linux x86_64; U; Opera Next; Ubuntu/11.04; en) Presto/2.8.131 Version/11.50

    Any plans to put this up somewhere for better and more organized collaboration? My suggestion: https://github.com/

    1. Opera 11.10 Opera 11.10 Mac OS X  10.7.0 Mac OS X 10.7.0
      Opera/9.80 (Macintosh; Intel Mac OS X 10.7.0; U; en) Presto/2.8.131 Version/11.10

      I hadn’t really thought about that, but it would be cool to get more fingers on this code to clean it up and add more features! I’ll see what I can do. 😉

  12. Opera 11.11 Opera 11.11 GNU/Linux GNU/Linux
    Opera/9.80 (X11; Linux i686; U; en) Presto/2.8.131 Version/11.11

    Full ACK to fearphage

    The Params of your script are confusing
    -q should be “quite”, means no output;
    -v “verbose”, full output (as now)

    Is it possible to query the open tabs, would make more sense than the speeddial (maybe only as subitem)

  13. Chromium 12.0.742.112 Chromium 12.0.742.112 Ubuntu 11.04 Ubuntu 11.04
    Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Ubuntu/11.04 Chromium/12.0.742.112 Chrome/12.0.742.112 Safari/534.30

    bonjour
    ESt-il possible avec le programme “motion” sous Linux de transférer automatiquement les images capturés sur le serveur-web de OperaUnité

    1. Opera Next 12.00 Opera Next 12.00 Ubuntu 11.04 x64 Ubuntu 11.04 x64
      Opera/9.80 (X11; Linux x86_64; U; Edition Next; Ubuntu/11.04 (natty); en) Presto/2.9.211 Version/12.00

      I partially understand you’re request after translating, but if you ask this in English then I may be able to answer you better.

      Cheers!

  14. Chromium 12.0.742.112 Chromium 12.0.742.112 Ubuntu 11.04 Ubuntu 11.04
    Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Ubuntu/11.04 Chromium/12.0.742.112 Chrome/12.0.742.112 Safari/534.30

    c’est du FTP avec wput

  15. Opera Next 12.14 Opera Next 12.14 GNU/Linux x64 GNU/Linux x64
    Opera/9.80 (X11; Linux x86_64; Edition Next) Presto/2.12.388 Version/12.14

    I’m getting a duplication of speed dial entries when using some of the defaults. It picks up both “redir.opera.com…” and the actual link and displays a duplicate in the right click menu. I fixed it by deleting all the default speed dial entries and substituting my own.

    Great script!

  16. Opera 12.14 Opera 12.14 GNU/Linux x64 GNU/Linux x64
    Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.14

    Regarding tracking download progress i think it could be done.
    First check download.dat in .opera folder. Its binary file, but you can parse it using strings command. There are few examples on my opera forum:
    http://my.opera.com/community/forums/topic.dml?id=168616&t=1363853744&page=1#comment1846625

    You could get file location, and total file size (received from server) using this command. Then simply check current file size in given location using “stat”.

    Of course in some cases server doesn’t send file size, then progress could keep going in loops until file size stops increasing, or not even run at all.

  17. Opera 12.14 Opera 12.14 GNU/Linux x64 GNU/Linux x64
    Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.14

    One way to do it:
    This gives you file locations (as on my opera):
    strings ~/.opera/download.dat | grep /home/$(echo $USER) | sed ‘s/^.//; s/.$//;’

    This gives you file sizes:
    strings ~/.opera/download.dat | grep -A1 Content-Length | grep -v Content-Length | sed ‘s/.$//;’

    And this way you get file size:
    stat -c %s [path-to-file]

Leave a Reply to kyleabaker Cancel reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: