Add some pre-existing scripts.
This commit is contained in:
29
qttrayicontest
Executable file
29
qttrayicontest
Executable file
@ -0,0 +1,29 @@
|
||||
#!/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])
|
Reference in New Issue
Block a user