diff --git a/hrafn.py b/hrafn.py index 3498115..f095ace 100755 --- a/hrafn.py +++ b/hrafn.py @@ -131,6 +131,12 @@ class Hrafn(): # Add a system tray icon self.tray_icon = gtk.status_icon_new_from_file('ui/icon.svg') self.tray_icon.connect('activate', self.on_tray_icon_clicked) + self.tray_icon.connect('popup-menu', self.on_tray_icon_popup) + self.tray_menu = gtk.Menu() + quit_item = gtk.MenuItem(gtk.STOCK_QUIT) + quit_item.connect('activate', self.gtk_main_quit) + self.tray_menu.attach(quit_item, 0, 1, 0, 1) + # Set the account label self.update_account_label() @@ -580,6 +586,10 @@ class Hrafn(): else: self.window.iconify() + + def on_tray_icon_popup(self, icon, button, activate_time): + self.tray_menu.popup(None, None, gtk.status_icon_position_menu, button, activate_time, self.tray_icon) + def on_window_state_changed(self, window, event): if event.changed_mask & gtk.gdk.WINDOW_STATE_ICONIFIED: