Cross-platform, super tiny implementation of a system tray icon with a popup menu.
Works well on:
- Linux/Gtk (libappindicator) - Gnome3 may need an extension
- Windows XP or newer (shellapi.h)
- MacOS (Cocoa/AppKit)
This fork is a different implementation based on Dmitry Mikushin's fork. using more modern c++ and standard library. He brought together the original work of Serge Zaitsev and the most interesting forks and PRs of respectable contributors:
- Only process messages coming from the tray window on Windows
- Become C++-friendly
- Fix all menu items have a check box
- Add support for tooltip
- Darwin implementation translated from C to Objective C adapted from @trevex fork
- CMake
- Ninja, in order to have the same build commands on all platforms
- AppIndicator on Linux:
Debian-based:
sudo apt install libappindicator3-dev
Arch-based:
sudo pacman -S libappindicator-gtk3
mkdir build
cd build
cmake -G Ninja ..
ninja
Personally, I open the folder in VSCode with CMake and CMake Tools extensions, that auto configures everything. Had some issues with the flatpak version, so I recommend installing from AUR or using Microsoft's .deb file on linux.
Execute the tray_example
application:
./tray_example
Needs updating. For now check example.cpp
This software is distributed under MIT license, so feel free to integrate it in your commercial products.