Prechádzať zdrojové kódy

Always bring manager to front on icon click.(#565)

Agnieszka Kostrzewa 12 rokov pred
rodič
commit
9d509917d6
2 zmenil súbory, kde vykonal 13 pridanie a 13 odobranie
  1. 12 12
      qubesmanager/main.py
  2. 1 1
      rpm_spec/qmgr.spec

+ 12 - 12
qubesmanager/main.py

@@ -1722,7 +1722,7 @@ class QubesTrayIcon(QSystemTrayIcon):
             # Handle the right click normally, i.e. display the context menu
             return
         else:
-            toggle_manager()
+            bring_manager_to_front()
 
     def addActions(self, target, actions):
         for action in actions:
@@ -1773,28 +1773,28 @@ def get_frame_size():
     manager_window.frame_height = h
     return
 
-
 def show_manager():
     manager_window.show()
+    manager_window.set_table_geom_size()
+    manager_window.update_table(True)
+
+    get_frame_size() 
+    #print manager_window.frame_width, " x ", manager_window.frame_height
+    manager_window.set_table_geom_size()
 
-def toggle_manager():
+def bring_manager_to_front():
+    
     if manager_window.isVisible():
-        manager_window.hide()
-    else:
-        manager_window.show()
-        manager_window.set_table_geom_size()
-        manager_window.update_table(True)
+        subprocess.check_call(['wmctrl', '-R', str(manager_window.windowTitle())])
 
-        get_frame_size() 
-        print manager_window.frame_width, " x ", manager_window.frame_height
-        manager_window.set_table_geom_size()
+    else:
+        show_manager()
 
 
 def exit_app():
     notifier.stop()
     app.exit()
 
-
 # Bases on the original code by:
 # Copyright (c) 2002-2007 Pascal Varet <p.varet@gmail.com>
 

+ 1 - 1
rpm_spec/qmgr.spec

@@ -12,7 +12,7 @@ Vendor:		Invisible Things Lab
 License:	GPL
 URL:		http://fixme
 Requires:	python, PyQt4, qubes-core-dom0 > 1.7.23, kdebase
-Requires:	pmount, cryptsetup
+Requires:	pmount, cryptsetup, wmctrl
 BuildRequires:	PyQt4-devel
 AutoReq:	0