From ec908bfeec712fc5e65025392c1604f0d95212db Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 17 Oct 2017 01:53:55 +0200 Subject: [feature] first stub for the systray --- src/leap/bitmask/gui/app.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/leap/bitmask') diff --git a/src/leap/bitmask/gui/app.py b/src/leap/bitmask/gui/app.py index 38a37c47..8ec15b2a 100644 --- a/src/leap/bitmask/gui/app.py +++ b/src/leap/bitmask/gui/app.py @@ -47,6 +47,11 @@ else: from PyQt5.QtCore import QSize from PyQt5.QtCore import QObject, pyqtSlot from PyQt5.QtWidgets import QApplication + from PyQt5.QtGui import QIcon + from PyQt5.QtWidgets import QMenu + from PyQt5.QtWidgets import QSystemTrayIcon + from PyQt5.QtWidgets import QDialog + try: from PyQt5.QtWebKitWidgets import QWebView from PyQt5.QtWebKit import QWebSettings @@ -66,7 +71,14 @@ bitmaskd = None browser = None -class BrowserWindow(QWebView): +class WithTrayIcon(QDialog): + + def createTrayIcon(self): + self.trayIcon = QSystemTrayIcon(self) + self.trayIcon.setContextMenu(self.trayIconMenu) + + +class BrowserWindow(QWebView, WithTrayIcon): """ This qt-webkit window exposes a couple of callable objects through the python-js bridge: @@ -216,6 +228,9 @@ def launch_gui(): print('ERROR: ' + e.message) sys.exit(1) + browser.createTrayIcon() + browser.trayIcon.show() + qApp.setQuitOnLastWindowClosed(True) qApp.lastWindowClosed.connect(browser.shutdown) -- cgit v1.2.3