Added a popup menu to the tray icon, but it doesn't pop up in a visible place yet (at least, not in fluxbox)
This commit is contained in:
parent
37e033ca34
commit
fbaf131849
10
hrafn.py
10
hrafn.py
|
@ -131,6 +131,12 @@ class Hrafn():
|
||||||
# Add a system tray icon
|
# Add a system tray icon
|
||||||
self.tray_icon = gtk.status_icon_new_from_file('ui/icon.svg')
|
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('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
|
# Set the account label
|
||||||
self.update_account_label()
|
self.update_account_label()
|
||||||
|
@ -581,6 +587,10 @@ class Hrafn():
|
||||||
self.window.iconify()
|
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):
|
def on_window_state_changed(self, window, event):
|
||||||
if event.changed_mask & gtk.gdk.WINDOW_STATE_ICONIFIED:
|
if event.changed_mask & gtk.gdk.WINDOW_STATE_ICONIFIED:
|
||||||
if event.new_window_state & gtk.gdk.WINDOW_STATE_ICONIFIED:
|
if event.new_window_state & gtk.gdk.WINDOW_STATE_ICONIFIED:
|
||||||
|
|
Reference in New Issue
Block a user