From 89c363d247e50b4f4338980f91e4213e1f378206 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Fri, 6 Nov 2015 20:43:37 -0500 Subject: [PATCH] Clean up and exit on Ctrl-Q --- onionshare_gui/onionshare_gui.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index b2642dbf..1794b945 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -42,6 +42,14 @@ class Application(QtGui.QApplication): if platform == 'Tails' or platform == 'Linux': self.setAttribute(QtCore.Qt.AA_X11InitThreads, True) QtGui.QApplication.__init__(self, sys.argv) + self.installEventFilter(self) + + def eventFilter(self, obj, event): + if (event.type() == QtCore.QEvent.KeyPress and + event.key() == QtCore.Qt.Key_Q and + event.modifiers() == QtCore.Qt.ControlModifier): + self.quit() + return False class OnionShareGui(QtGui.QWidget):