Skip to content

Commit

Permalink
add tray
Browse files Browse the repository at this point in the history
  • Loading branch information
shadeyg56 committed Feb 1, 2023
1 parent 2bfe71e commit 31095c4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
Binary file added auto_cpufreq/tray/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added auto_cpufreq/tray/reddit-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions auto_cpufreq/tray/tray.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *

import os

CURRENT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))

app = QApplication([])
app.setQuitOnLastWindowClosed(False)

icon = QIcon(os.path.join(CURRENT_DIRECTORY, "icon.png"))

tray = QSystemTrayIcon(icon, app)
tray.setIcon(icon)
tray.setVisible(True)
print(tray.icon().name())
print(icon.State)
print(os.path.join(CURRENT_DIRECTORY, "reddit-logo.png"))

menu = QMenu()
option1 = QAction("Test")
option2 = QAction("Hello World")
menu.addAction(option1)
menu.addAction(option2)

quit = QAction("Quit")
quit.triggered.connect(app.quit)
menu.addAction(quit)

tray.setContextMenu(menu)

app.exec_()

0 comments on commit 31095c4

Please sign in to comment.