I am looking for a solution (application) that would allow me to make a request to particular web page every x seconds and retrieve the number (the number is the only content there, no html, no xml or anything else) and display this number in the taskbar.

Is there such application out there?

Thank you

  • what I don't understand: how is this number to be fetched? where is it stored / displayed? could you give an example? Oct 23 '14 at 10:22
  • @JacobVlijm the URL probably returns a plain text file without any markup, just the content.
    – muru
    Oct 23 '14 at 11:22

The following python snippet should work for you:

#!/usr/bin/env python

import re
import sys
import urllib2

from gi.repository import Gtk, GLib
from gi.repository import AppIndicator3 as appindicator

class MyIndicator:

    def __init__(self):
    # Create Indicator with icon and label
        icon_image = "/usr/share/unity/icons/panel-shadow.png"
        self.ind = appindicator.Indicator.new(

    # Menu structure
    def menu_structure(self):
        # GTK menu
        self.menu = Gtk.Menu()
        self.exit = Gtk.MenuItem("Exit")
        self.exit.connect("activate", self.quit)

        content = urllib2.urlopen('http://askubuntu.com/questions')
        questions = re.search('<div class="summarycount al">(.*?)</div>', content.read())
        self.ind.set_label(str(questions.group(1)), "")


    def quit(self, widget):

if __name__ == "__main__":
    indicator = MyIndicator()

Just replace the url, the 2 second delay and the re.search pattern for your needs.

re.search('(.*)', content.read()) should work if your file only contains the number.

The above code displays the total questions on Askubuntu in your taskbar:


Reference: https://unity.ubuntu.com/projects/appindicators/

  • 1
    Thank you so much, this really answered my question in much deeper way I could have expected! Brilliant solution! Thanks.
    – Maris
    Oct 23 '14 at 12:48
  • @Maris: just added a reference link in case you are also interested by a C implementation ;) Oct 23 '14 at 12:49
  • Thank you, all these programming things are new to me so no idea how C implementation is better than python? Ideally I would love this one to be executed at startup and let it be there for my whole work-session.
    – Maris
    Oct 23 '14 at 12:51
  • @Maris To run this script at startup, please read How to run scripts on start up Oct 23 '14 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.