<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>A few versions ago in Fedora (v15), the PackageKit daemon
      doesn't work in XFCE anymore, so I wrote a small Perl Gtk2 app
      that would watch for available yum updates and put a tray icon in
      your Notification Area to notify you (Perl version: </tt>
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
    <tt><a href="http://sh.kirsle.net/kupdatesd">http://sh.kirsle.net/kupdatesd</a></tt><tt>)</tt><tt><br>
    </tt><tt><br>
    </tt><tt>I've recently ported the app over to Python 2. I heard that
      the Fedora XFCE spins are going to drop Perl (or at least severely
      shrink the Perl installation) to save space, so the Python version
      of this app will be useful going forward (on my current Fedora 18
      XFCE desktops, pygtk2 was already installed, which is pretty much
      this script's only dependency). :)</tt><tt><br>
    </tt><tt><br>
    </tt><tt>Source code to pyupdatesd: </tt>
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
    <tt><a href="http://sh.kirsle.net/pyupdatesd">http://sh.kirsle.net/pyupdatesd</a></tt><tt>
      - this code is open domain and you can do with it what you please.
      It would be neat if this could be shipped with future releases of
      the Fedora XFCE spin.</tt><tt><br>
    </tt><tt><br>
    </tt><tt>Here's the source code here also, in case the links are
      down. This version has only been lightly tested (I literally just
      finished writing it an hour ago), but seems to work so far.</tt><tt><br>
    </tt><tt>_____________________________________</tt><tt><br>
    </tt><tt><br>
    </tt>
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
    <pre style="color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/env python

"""
pyupdatesd: A simple yum update checker.

This script will watch for available yum updates and show a Gtk2 tray icon and
notification pop-up when updates become available.

This is intended for desktop environments like XFCE that don't have a native
PackageKit update watcher.

Set this script to run on session startup, and it will check for updates every
15 minutes (by default; this is configurable in the source code).

This software is open domain and may be freely modified and distributed.

Requires: pygtk2

--Kirsle
<a class="moz-txt-link-freetext" href="http://sh.kirsle.net">http://sh.kirsle.net</a>
"""

################################################################################
# Configuration Section Begins Here                                            #
################################################################################

c = dict(
    # The title to be shown on the pop-up and the icon tooltip.
    title = "Updates Available",

    # The message to be shown in the pop-up.
    message = "There are updates available to install.",

    # Icon to use in the system tray and pop-up.
    icon = "/usr/share/icons/gnome/32x32/status/software-update-available.png",

    # Frequency to check for available updates.
    interval = 900, # 15 minutes

    # Command to run to check for available updates, and the expected status
    # code that indicates updates are available.
    check = "/usr/bin/yum check-update",

    # Path to notify-send (set to None if you don't want notifications)
    notify = "/usr/bin/notify-send",

    # Command to run for your graphical updater (i.e. yumex, gpk-update-viewer)
    gui = "/usr/bin/yumex",
)

################################################################################
# Configuration Section Ends Here                                              #
################################################################################

import gtk
import gobject

import commands
import subprocess
from time import time

def do_updates():
    """Show your graphical update manager."""
    subprocess.call(c['gui'], shell=True)

def onClick(widget):
    """Event handler for the tray icon being clicked."""
    widget.set_visible(False)
    gobject.timeout_add(1, do_updates)

def show_notify():
    subprocess.call([c['notify'],
        '-a', __name__,
        '-i', c['icon'],
        c['message'],
    ])

tray = gtk.StatusIcon()
tray.set_from_file(c['icon'])
tray.set_title(c['title'])
tray.set_tooltip(c['title'])
tray.set_visible(False)
tray.connect('activate', onClick)

next_check = int(time()) + c['interval']
def main_loop():
    # Time to check?
    global next_check
    if int(time()) &gt;= next_check:
        status, output = commands.getstatusoutput(c['check'])
        status = status &gt;&gt; 8

        # Updates?
        if status == 100:
            tray.set_visible(True)
            show_notify()
        elif tray.get_visible() == True and status == 0:
            # Updates have disappeared behind our back!
            tray.set_visible(False)

        next_check = int(time()) + c['interval']

    gobject.timeout_add(1000, main_loop)

gobject.timeout_add(1000, main_loop)

gtk.main()

# vim:expandtab</pre>
    <tt><br>
    </tt>
  </body>
</html>