Categories We Write About

Create a system tray app

Creating a simple system tray app depends on the programming language and framework you want to use. Here’s a straightforward example in Python using PyQt5, which is commonly used for GUI and system tray apps.


Python System Tray App with PyQt5

This example creates a system tray icon with a menu and an option to quit the app.

python
import sys from PyQt5.QtWidgets import QApplication, QSystemTrayIcon, QMenu, QAction from PyQt5.QtGui import QIcon def main(): app = QApplication(sys.argv) app.setQuitOnLastWindowClosed(False) # Keeps the app running without windows # Create the system tray icon tray_icon = QSystemTrayIcon(QIcon("icon.png"), parent=app) tray_icon.setToolTip("My System Tray App") # Create the menu for the tray icon menu = QMenu() # Add actions to the menu quit_action = QAction("Quit") quit_action.triggered.connect(app.quit) menu.addAction(quit_action) # Set the menu to the tray icon tray_icon.setContextMenu(menu) # Show the tray icon tray_icon.show() sys.exit(app.exec_()) if __name__ == "__main__": main()

What you need:

  • PyQt5 installed:

bash
pip install PyQt5
  • An icon file named icon.png in the same directory as the script (can be any small image).


How it works:

  • The app runs without a visible window.

  • It shows an icon in the system tray.

  • Right-clicking the icon shows a menu with a “Quit” option.

  • Clicking “Quit” exits the app.


If you want a system tray app in another language or with more features, just let me know!

Share This Page:

Enter your email below to join The Palos Publishing Company Email List

We respect your email privacy

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories We Write About