Gnome Forismatic Notify Applet

    Good afternoon!
    Having started using python for his administrative purposes, a la writing simple scripts, I could not get enough of the simplicity of this language. Almost immediately, there was a desire to try to write a full-fledged application in python. But he could not have figured out what to create to make it interesting and useful, not only for me. The idea came after reading this topic on the hub, unfortunately it is not available now, but, if briefly, we are talking about displaying quotes from the site when opening the console.
    I decided it would be nice to write an applet for gnome that will show the same quotes, but with the help of notifications. Then I would not have to open a new console to read the next quote. I liked the result, and I wanted to share it with the community.

    Briefly about the program

    The applet itself is a regular icon on the gnome panel.

    When you click on the icon with the left mouse button, a quote appears in the form of a pop-up notification. But if you don’t click on the applet, notifications with quotes will still appear every 30 minutes (by default).

    All settings are summarized in a small menu.

    Using the menu you can:
    • Choose one of two themes - blue (standard for and black.
    • Change the language in which quotes will be displayed (English or Russian)
    • Change the time period between impressions of quotes (in the range of 5-300 min).

    By clicking the middle mouse button on the applet icon, the page with the latest quote on will open. The action is duplicated using the ShowQuote menu item .

    Technical details

    The applet is written in pygtk. All additional modules that I had to use included a standard set of python, so there shouldn't be any problems with dependencies.
    Quotations are taken using the API in the form of xml and after parsing are stored in the Gconf keys at the address . This allows you to run multiple copies of the applet with various settings at once. The Preferences window was created in glade. This article helped a lot in creating the applet , with which the template for the applet was successfully licked./apps/panel/applets/applet_id/pref/


    So far I can single out only one global problem - the entire applet hangs while receiving another quote from the site. As I understand it, having re-read a lot of thematic forums, this can only be solved using threading. Select one thread for drawing graphics, and a second thread for working with the API.

    The second item on the TODO list is to make an error reporting system. Currently, in debug mode, errors are only displayed in stdout. And in applet mode, error notifications are completely absent. If someone else likes the program, then I will try to find the time and modify it.

    I can not help but complain about the GTK itself and its strangeprocessing of mouse clicks due to which a beautiful idea failed with the opening of the site by double-clicking. Perhaps it’s right that before generating the 2BUTTON_PRESS event , two BUTTON_PRESS events are also generated , but because of this I did not come up with a normal way to hang various actions on a single and double mouse click.
    If someone from the Habr community tells me how to implement this, I will be very grateful.


    There was an idea to create a deb package, but, unfortunately, after an evening spent reading the documentation, I still did not understand how to do this in the case of python. Therefore, to install the applet, you can download the sources from or and manually copy the files to the necessary folders: For the sake of confidence, I would recommend restarting gnome. After that, Forismatic Applet appears in the PCM-> add menu.
    sudo cp -a ForismaticApplet /usr/share/
    sudo cp forismatic_notify.server /usr/lib/bonobo/servers/


    This is my first experience in programming GUI applications, so I hope that the criticism will be constructive and not very strict.
    Naturally, I will try to take into account and fix all the bugs found.

    UPD: Added a deb package (thanks to fenrirgray ), you can download it from the same and . For example, a link from the latest ForismaticNotify_Applet_0.7b-1_all.deb . But, nevertheless, it would be better to go to the repository and download there to be sure that this is the latest version of the package.

    Also popular now: