Noah Petherbridge hat auf der Fedora Xfce-Liste ein Skript vorgestellt, welches die Updatebenachrichtigungen von PackageKit unter Gnome nachbildet, da es seit dem Umstieg auf Gnome 3 kein PackageKit Applet mehr für GTK2 basierte Desktops wie Xfce oder LXDE gibt.
Petherbridge stellt das Skript sowohl in einer Python- als auch in einer Perl-Variante auf seiner Homepage zu Download bereit. Weiterhin regt er an, das Skript auch in zukünftige Versionen des Xfce-Spins von Fedora zu integrieren.
Eine erweiterte Version der Python-Variante, welche bereits beim Aufruf nach Updates sucht, gibt es bei uns.
#!/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
http://sh.kirsle.net
"""
################################################################################
# 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",
# Check on startup for available updates. Set to False to disable
startcheck = True,
)
################################################################################
# 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']
startup = c['startcheck']
def main_loop():
# Time to check?
global next_check
global startup
if int(time()) >= next_check or startup:
if startup:
startup = False
status, output = commands.getstatusoutput(c['check'])
status = status >> 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:expandt
Note that there is a replacement for the PackageKit Applet available at https://gitorious.org/opensuse/pk-update-icon which is used by the openSUSE Xfce/LXDE desktops. In contrast to this hack, it is written in C and actually makes use of the PackageKit API and thus consumes much less memory while supporting any distribution that makes use of PackgeKit.
But there is a small problem: At least the Xfce spins don’t contain PackageKit anymore