From 9886b618404429a387dfb5dbb355033464568cd9 Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Tue, 27 Oct 2009 19:45:52 +0200 Subject: [PATCH] Tray icon click toggles window visibility Many of the tools that place an icon in systray allow to toggle the application visibility by left-clicking on the icon. Why not follow suit? --- pyfpdb/fpdb.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py index 5370bccb..0b3c4f4a 100755 --- a/pyfpdb/fpdb.py +++ b/pyfpdb/fpdb.py @@ -678,8 +678,14 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt") pass def statusicon_activate(self, widget, data = None): - self.window.show() - self.window.present() + # Let's allow the tray icon to toggle window visibility, the way + # most other apps work + shown = self.window.get_property('visible') + if shown: + self.window.hide() + else: + self.window.show() + self.window.present() def warning_box(self, str, diatitle="FPDB WARNING"): diaWarning = gtk.Dialog(title=diatitle, parent=None, flags=0, buttons=(gtk.STOCK_OK,gtk.RESPONSE_OK))