| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Cross-platform C++17 Qt-backed system tray icon with a popup menu and notifications.
This is a fork of dmikushin/tray and is intended to add additional features required for our own Sunshine project.
This fork adds the following features:
Install either Qt6 or Qt5.
# Qt6
sudo pacman -S qt6-base qt6-svg
# Qt5
sudo pacman -S qt5-base qt5-svg# Qt6
sudo apt install qt6-base-dev qt6-svg-dev
# Qt5
sudo apt install qtbase5-dev libqt5svg5-dev# Qt6
sudo dnf install qt6-qtbase-devel qt6-qtsvg-devel
# Qt5
sudo dnf install qt5-qtbase-devel qt5-qtsvg-develbrew install cmake ninja qtbase qtsvgpacman -S mingw-w64-ucrt-x86_64-cmake \
mingw-w64-ucrt-x86_64-ninja \
mingw-w64-ucrt-x86_64-toolchain \
mingw-w64-ucrt-x86_64-qt6-base \
mingw-w64-ucrt-x86_64-qt6-svgmkdir -p build
cmake -G Ninja -B build -S .
ninja -C buildInstall uv and initialize the shared tooling submodule:
git submodule update --init --recursive third-party/lizardbyte-common
uv run --project third-party/lizardbyte-common --locked --only-group lint-c \
python third-party/lizardbyte-common/scripts/update_clang_format.pyExecute the tray_example application:
./build/tray_exampleExecute the tests application:
./build/tests/test_trayThe icon and notification_icon fields can be a path to an image file or an icon theme name. Relative file paths are resolved from the process working directory, so applications should copy or install icon files where the running process can find them.
SVG, ICO, PNG, and Qt theme icon names are supported.
For the most predictable cross-platform behavior, use SVG or PNG files for both tray and notification icons. ICO is supported by the Qt-backed paths tested by this project. Qt theme icons should be passed as icon name strings, such as mail-message-new.
Tray structure defines an icon and a menu. Menu is a NULL-terminated array of items. Menu item defines menu text, menu checked and disabled (grayed) flags and a callback with some optional context pointer.
struct tray {
char *icon;
struct tray_menu *menu;
};
struct tray_menu {
char *text;
int disabled;
int checked;
void (*cb)(struct tray_menu *);
void *context;
struct tray_menu *submenu;
};All functions are meant to be called from the UI thread only.
Menu arrays must be terminated with a NULL item, e.g. the last item in the array must have text field set to NULL.
This software is distributed under MIT license, so feel free to integrate it in your commercial products.
| Back | FazBrowse Home | New Git URL |