30 lines
836 B
Python
Executable File
30 lines
836 B
Python
Executable File
#!/usr/bin/env python3
|
|
# setf=python
|
|
|
|
# taken from stackexchange
|
|
import sys
|
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
|
|
|
class SystemTrayIcon(QtWidgets.QSystemTrayIcon):
|
|
def __init__(self, icon, parent=None):
|
|
QtWidgets.QSystemTrayIcon.__init__(self, icon, parent)
|
|
menu = QtWidgets.QMenu(parent)
|
|
exitAction = menu.addAction("Exit")
|
|
exitAction.triggered.connect(self.exit)
|
|
self.setContextMenu(menu)
|
|
|
|
def exit(self):
|
|
QtCore.QCoreApplication.exit()
|
|
|
|
def main(iconName):
|
|
app = QtWidgets.QApplication(sys.argv)
|
|
|
|
w = QtWidgets.QWidget()
|
|
trayIcon = SystemTrayIcon(QtGui.QIcon.fromTheme(iconName), w)
|
|
|
|
trayIcon.show()
|
|
sys.exit(app.exec_())
|
|
|
|
if __name__ == '__main__':
|
|
main(sys.argv[1])
|