Opera Tab Count in Conky (for Linux)

Have you ever wanted to keep an eye on the number of tabs that you have open in Opera? Now you can very easily!

Check Out The Script!

I came across a link a while back (sorry, I can’t remember who posted this) for a script in windows that fetches the window count from Opera’s autosave.win file (this file stores your currently open windows and tabs so it can restore them if Opera crashes or for the next time you open Opera).

If you’re using Windows, you can probably do something with this script, though I have not tested it yet.

If you’re using Linux then you can take advantage of a script that I wrote and I’ll tell you how below.

  1. Open a text editor and copy the 10 lines of script from the following page:
    http://kyleabaker.pastebin.com/HngpxisB
  2. Save this file anywhere you would like to. I saved mine as “opera-tab-count.sh” on my desktop for testing, but it should work fine from any directory.
  3. Right click on the file you created and select “Properties -> Permissions -> Execute = True“. This allows the script file to run.
  4. Now you can open up a terminal window and find out how many tabs you have open by using the following command:
    $ ./.opera-tab-count.sh

Add This To Conky!

One of the main reasons that I wrote this script is to start showing more Opera stats on my desktop via Conky which I wrote about a while back!

Opera tab count as it will appear in Conky!

If you’re interested in displaying some stats via Conky then all you have to do to get what I’ve got is:

  1. Move the “opera-tab-count.sh” file that you’ve saved from the steps above into your Home directory.
  2. Rename your “opera-tab-count.sh” file to “.opera-tab-count.sh” (notice the leading period). This makes it a hidden file in the future so it won’t waste space in your file browser unless you choose to view Hidden files via “View menu -> Show Hidden Files”.
  3. Add the following lines to your “.conkyrc” file (located in your root directory)
    ${color orange}OPERA ${hr 2}$color
    Opera currently has ${exec ./.opera-tab-count.sh} tabs open
  4. Save your “.conkyrc” file and launch Conky or wait for it to refresh with your update!

If you did everything correctly then you should see something similar to what the image above.

I do plan to add more stats to this soon and will probably post a link to my script when I’m done, so keep an eye out!

*You Mac users may be able to modify this to work with Mac as well. 😉

UPDATE 1 (2010-05-04):
If you want to use my latest update with more details, create a file named “.opera-stats.sh” that is executable and stored in your Home directory (old: with the script from here) with the script that fearphage has updated here. Now add two lines (or edit the two you added from above) to your “.conkyrc” file:
${color orange}OPERA ${hr 2}$color
${exec ./.opera-stats.sh}

..that should give you the following:

Opera Stats v0.1 in Conky

Want cool desktop stats? -> Conky!

Have you ever wanted to have awesome looking stats on that rest on your desktop and don’t interfere with your work flow? If so, you’ll probably love this nifty little application.

Example of a basic Conky setup.

Its called Conky and it can give you stats or information on practically anything imaginable. Its also easy to install!

Conky is by no means a new application and there are in fact hundreds of Conky configuration files scattered across the Internet that you could use to customize the way yours looks. With a good basic guide and some helpful tips on auto-starting Conky, I’ve thrown together a quick installation and setup guide with pictures! 😉

Typically when you install an application such as this, you want it to auto-start. Auto-starting this application isn’t as trivial as most applications so I’ll walk you through that as well. I’ll assume your using Ubuntu of some sort, but if you’re not don’t worry…you can still install Conky with alternative steps and setting it up should not differ.

Install

  1. Open the “Ubuntu Software Center” application (also known as “Add/Remove” in older versions) and search for Conky. If its not listed then you may need to find a package online.

    Find and install the Conky option entitled something along these lines: “highly configurable system monitor (all features enabled)“.

  2. Create a file labeled “.conkyrc” in your home directory (usually saved as /home/username/.conkyrc) and make sure to include the period at the start. This will make the conky settings file hidden when you casually open your home folder so its not in your way. You may need to go to View -> Show Hidden Files or press Ctrl+H to view the file to edit it later.

    Open the “.conkyrc” file in a text editor of your choice.
    Paste the linked snippet into your “.conkyrc” file.

  3. Create a file labeled “.startconky.sh” in the same folder as the previous file making sure to include the period at the beginning and the file type at the end.

    Open the “.startconky.sh” file with your favorite editor. Paste the following snippet into your “.startconk.sh” file:
    #!/bin/bash
    (sleep 5s && conky) &


  4. Save both files and close the file editor you were using. Now right-click on the “.startconky.sh” file and click Properties and select the Properties tab. Make sure you check the option to “Allow executing file as program” then click close.
  5. Go to your startup applications program or System -> Preferences -> Startup Applications and add a new application with the command option as “/home/username/.startconky.sh” where user name is your home directory…as follows:
  6. Click Save! Now the next time your restart your computer you’ll have some awesome stats that appear on your desktop!