Handles the system tray icon and notification system. More...
Functions | |
| void | clear_tray_notification () |
| Clear notification fields before replacing the tray state. | |
| int | end_tray () |
| Exit the system tray. | |
| const char * | GetResourcePath (const char *relativePath) |
| Get resource path. | |
| int | init_tray () |
| Initializes the system tray without starting a loop. | |
| int | init_tray_threaded () |
| Initializes and runs the system tray in a separate thread. | |
| int | init_tray_with_stop_token (const std::stop_token stop_token) |
| Initialize the tray, optionally observing an owning thread's stop request. | |
| std::array< struct tray_menu, 9 > | initial_virtualhid_license_menu () |
| Create the initial Virtual HID Broker license submenu. | |
| void | prepare_tray_virtualhid_driver () |
| Query the Virtual HID Broker version and prepare its startup notification. | |
| void | prepare_tray_virtualhid_license () |
| Query the Virtual HID Broker license and prepare the startup tray state. | |
| int | process_tray_events () |
| Processes a single tray event iteration. | |
| void | rebuild_virtualhid_license_menu (const lvh::LicenseStatus &license) |
| Rebuild the Virtual HID Broker submenu for the latest license state. | |
| void | resolve_tray_icon_paths () |
| Resolve tray icons against the current executable or application bundle. | |
| void | run_tray_until_exit (const std::shared_ptr< safe::event_t< bool > > &shutdown_event) |
| Process tray events until exit and notify the application's workers. | |
| template<typename Callback = std::nullptr_t> | |
| void | set_virtualhid_license_menu_item (const std::size_t index, std::string text, const bool disabled, Callback callback=nullptr) |
| Assign text and behavior to one Virtual HID Broker submenu item. | |
| void | tray_donate_github_cb (struct tray_menu *item) |
| Callback for opening GitHub Sponsors from the system tray. | |
| void | tray_donate_patreon_cb (struct tray_menu *item) |
| Callback for opening Patreon from the system tray. | |
| void | tray_donate_paypal_cb (struct tray_menu *item) |
| Callback for opening PayPal donation from the system tray. | |
| void | tray_native_menu_click_cb (struct tray *tray_icon) |
| Leave macOS tray menu presentation to Qt's native status item. | |
| void | tray_open_ui_cb (struct tray_menu *item) |
| Callback for opening the UI from the system tray. | |
| void | tray_quit_cb (struct tray_menu *item) |
| Callback for exiting Sunshine from the system tray. | |
| void | tray_reset_display_device_config_cb (struct tray_menu *item) |
| Callback for resetting display device configuration. | |
| void | tray_restart_cb (struct tray_menu *item) |
| Callback for restarting Sunshine from the system tray. | |
| void | tray_virtualhid_download_cb (struct tray_menu *item) |
| Callback for opening the latest Virtual HID Broker release. | |
| void | tray_virtualhid_license_cb (struct tray_menu *item) |
| Callback for opening Virtual HID Broker license settings in the Web UI. | |
| void | update_tray_pausing (std::string app_name) |
| Sets the tray icon in pausing mode (stream stopped but app running) and spawns the appropriate notification. | |
| void | update_tray_playing (std::string app_name) |
| Sets the tray icon in playing mode and spawns the appropriate notification. | |
| void | update_tray_require_pin () |
| Spawns a notification for PIN Pairing. Clicking it opens the PIN Web UI Page. | |
| void | update_tray_stopped (std::string app_name) |
| Sets the tray icon in stopped mode (app and stream stopped) and spawns the appropriate notification. | |
| void | update_tray_virtualhid_driver (bool installed, std::string_view version, bool version_compatible, std::string_view supported_versions) |
| Show an update notification for an unsupported Virtual HID Broker. | |
| void | update_tray_virtualhid_license (const lvh::LicenseStatus &license, bool notify_if_unlicensed) |
| Update the Virtual HID Broker license submenu and optional notification. | |
| std::string_view | virtualhid_license_state_detail (lvh::LicenseState state) |
| Return explanatory tray text for a non-active license state. | |
| std::string_view | virtualhid_license_state_label (lvh::LicenseState state) |
| Return the user-visible label for a Virtual HID Broker license state. | |
Variables | |
| constexpr auto | LIBVIRTUALHID_RELEASES_URL = "https://github.com/LizardByte/libvirtualhid/releases/latest"sv |
| Latest Virtual HID Broker release. | |
Handles the system tray icon and notification system.
| int system_tray::end_tray | ( | ) |
Exit the system tray.
| const char * system_tray::GetResourcePath | ( | const char * | relativePath | ) |
Get resource path.
| relativePath | Relative path. |
| int system_tray::init_tray | ( | ) |
Initializes the system tray without starting a loop.
| int system_tray::init_tray_threaded | ( | ) |
Initializes and runs the system tray in a separate thread.
| int system_tray::init_tray_with_stop_token | ( | const std::stop_token | stop_token | ) |
Initialize the tray, optionally observing an owning thread's stop request.
| stop_token | Stop token supplied by the managed tray worker, or an empty token for direct initialization. |
| std::array< struct tray_menu, 9 > system_tray::initial_virtualhid_license_menu | ( | ) |
Create the initial Virtual HID Broker license submenu.
| int system_tray::process_tray_events | ( | ) |
Processes a single tray event iteration.
| void system_tray::rebuild_virtualhid_license_menu | ( | const lvh::LicenseStatus & | license | ) |
Rebuild the Virtual HID Broker submenu for the latest license state.
| license | Latest machine license details. |
| void system_tray::run_tray_until_exit | ( | const std::shared_ptr< safe::event_t< bool > > & | shutdown_event | ) |
Process tray events until exit and notify the application's workers.
| shutdown_event | Event used to stop Sunshine's server threads. |
| void system_tray::set_virtualhid_license_menu_item | ( | const std::size_t | index, |
| std::string | text, | ||
| const bool | disabled, | ||
| Callback | callback = nullptr ) |
Assign text and behavior to one Virtual HID Broker submenu item.
| Callback | Callback type accepted by the tray library. |
| index | Submenu index to populate. |
| text | User-visible menu text. |
| disabled | Whether the item is informational rather than actionable. |
| callback | Callback invoked for actionable items. |
| void system_tray::tray_donate_github_cb | ( | struct tray_menu * | item | ) |
Callback for opening GitHub Sponsors from the system tray.
| item | The tray menu item. |
| void system_tray::tray_donate_patreon_cb | ( | struct tray_menu * | item | ) |
Callback for opening Patreon from the system tray.
| item | The tray menu item. |
| void system_tray::tray_donate_paypal_cb | ( | struct tray_menu * | item | ) |
Callback for opening PayPal donation from the system tray.
| item | The tray menu item. |
| void system_tray::tray_native_menu_click_cb | ( | struct tray * | tray_icon | ) |
Leave macOS tray menu presentation to Qt's native status item.
Qt opens an attached context menu on mouse press. Supplying a callback prevents the tray library from opening a second popup on activation.
| tray_icon | Tray icon that received the click. |
| void system_tray::tray_open_ui_cb | ( | struct tray_menu * | item | ) |
Callback for opening the UI from the system tray.
| item | The tray menu item. |
| void system_tray::tray_quit_cb | ( | struct tray_menu * | item | ) |
Callback for exiting Sunshine from the system tray.
| item | The tray menu item. |
| void system_tray::tray_reset_display_device_config_cb | ( | struct tray_menu * | item | ) |
Callback for resetting display device configuration.
| item | The tray menu item. |
| void system_tray::tray_restart_cb | ( | struct tray_menu * | item | ) |
Callback for restarting Sunshine from the system tray.
| item | The tray menu item. |
| void system_tray::tray_virtualhid_download_cb | ( | struct tray_menu * | item | ) |
Callback for opening the latest Virtual HID Broker release.
| item | The tray menu item. |
| void system_tray::tray_virtualhid_license_cb | ( | struct tray_menu * | item | ) |
Callback for opening Virtual HID Broker license settings in the Web UI.
| item | The tray menu item. |
| void system_tray::update_tray_pausing | ( | std::string | app_name | ) |
Sets the tray icon in pausing mode (stream stopped but app running) and spawns the appropriate notification.
| app_name | The paused application name |
| void system_tray::update_tray_playing | ( | std::string | app_name | ) |
Sets the tray icon in playing mode and spawns the appropriate notification.
| app_name | The started application name |
| void system_tray::update_tray_stopped | ( | std::string | app_name | ) |
Sets the tray icon in stopped mode (app and stream stopped) and spawns the appropriate notification.
| app_name | The started application name |
| void system_tray::update_tray_virtualhid_driver | ( | bool | installed, |
| std::string_view | version, | ||
| bool | version_compatible, | ||
| std::string_view | supported_versions ) |
Show an update notification for an unsupported Virtual HID Broker.
Existing notifications are preserved when gamepad input is disabled, the broker is absent or supported, or the Windows backend choice does not use the broker.
| installed | Whether the broker is installed. |
| version | Installed broker version. |
| version_compatible | Whether Sunshine supports the installed version. |
| supported_versions | User-visible supported version range. |
| void system_tray::update_tray_virtualhid_license | ( | const lvh::LicenseStatus & | license, |
| bool | notify_if_unlicensed ) |
Update the Virtual HID Broker license submenu and optional notification.
| license | Latest machine license details. |
| notify_if_unlicensed | Whether to notify the user when the broker needs a license. |
| std::string_view system_tray::virtualhid_license_state_detail | ( | lvh::LicenseState | state | ) |
Return explanatory tray text for a non-active license state.
| state | License state reported by libvirtualhid. |
| std::string_view system_tray::virtualhid_license_state_label | ( | lvh::LicenseState | state | ) |
Return the user-visible label for a Virtual HID Broker license state.
| state | License state reported by libvirtualhid. |