Je viens de te faire un petit script ruby qui te fait ca. Il a besoin que les hdlist soient à jour donc que par exemple dans le cron de root tu aies un urpmi.update -a de temps en temps.
Le code est vraiment crade mais à l'air de marcher /o\
#!/usr/bin/ruby
require 'gtktrayicon'
def update_status
if (!$running)
$running = true;
# Don't run long check if hdlists did not change
m = Dir.entries("/var/lib/urpmi/").map{|f| File.stat("/var/lib/urpmi/"+f).mtime}.max
if (m != $mtime)
mtime = m
packages=`urpmq --nolock --auto-select`
count=packages.count("\n")
$tooltips.set_tip($tray, "\n#{count.to_s} new packages available:\n#{packages}", nil)
$icon.set(Gtk::Stock::NO, Gtk::IconSize::SMALL_TOOLBAR) if count > 0
end
$running = false;
end
end
Gtk.init
# Create the interface
$tray = Gtk::TrayIcon.new("update")
$icon=Gtk::Image.new(Gtk::Stock::YES, Gtk::IconSize::SMALL_TOOLBAR)
$tray.add($icon)
$tooltips = Gtk::Tooltips.new
$tooltips.set_tip($tray, "unknown", nil)
# Add a menu to exit
menu = Gtk::Menu.new
item = Gtk::ImageMenuItem.new(Gtk::Stock::QUIT)
item.signal_connect("activate") { Gtk.main_quit }
item.show
menu.append(item)
$tray.add_events(Gdk::Event::BUTTON_PRESS_MASK)
$tray.add_events(Gdk::Event::BUTTON_RELEASE_MASK)
$tray.signal_connect('button-release-event') { |w, e|
menu.popup(nil, nil, e.button, e.time) if e.button == 3
}
# Update status every 10 minutes
Gtk.timeout_add(600000) {
Thread.new { update_status }
true
}
# Get current status one first time
Thread.new { update_status }
# Start the interface
$tray.show_all
Gtk.main
# Pas trop dur à coder :)
Posté par Pascal Terjan . En réponse au message Recherche Update notifier. Évalué à 2.
#!/usr/bin/ruby require 'gtktrayicon' def update_status if (!$running) $running = true; # Don't run long check if hdlists did not change m = Dir.entries("/var/lib/urpmi/").map{|f| File.stat("/var/lib/urpmi/"+f).mtime}.max if (m != $mtime) mtime = m packages=`urpmq --nolock --auto-select` count=packages.count("\n") $tooltips.set_tip($tray, "\n#{count.to_s} new packages available:\n#{packages}", nil) $icon.set(Gtk::Stock::NO, Gtk::IconSize::SMALL_TOOLBAR) if count > 0 end $running = false; end end Gtk.init # Create the interface $tray = Gtk::TrayIcon.new("update") $icon=Gtk::Image.new(Gtk::Stock::YES, Gtk::IconSize::SMALL_TOOLBAR) $tray.add($icon) $tooltips = Gtk::Tooltips.new $tooltips.set_tip($tray, "unknown", nil) # Add a menu to exit menu = Gtk::Menu.new item = Gtk::ImageMenuItem.new(Gtk::Stock::QUIT) item.signal_connect("activate") { Gtk.main_quit } item.show menu.append(item) $tray.add_events(Gdk::Event::BUTTON_PRESS_MASK) $tray.add_events(Gdk::Event::BUTTON_RELEASE_MASK) $tray.signal_connect('button-release-event') { |w, e| menu.popup(nil, nil, e.button, e.time) if e.button == 3 } # Update status every 10 minutes Gtk.timeout_add(600000) { Thread.new { update_status } true } # Get current status one first time Thread.new { update_status } # Start the interface $tray.show_all Gtk.main