Sunshine0.0.5917
Sunshine 0.0.5917
Self-hosted game stream host for Moonlight.
Loading...
Searching...
No Matches
system_tray.h
Go to the documentation of this file.
1
5#pragma once
6
7// standard includes
8#include <memory>
9#include <string>
10#include <string_view>
11
12namespace safe {
13 template<class T>
14 class event_t;
15}
16
17#if defined(_WIN32) || defined(__APPLE__)
18namespace lvh {
19 struct LicenseStatus;
20}
21#endif
22
26namespace system_tray {
31 void tray_open_ui_cb([[maybe_unused]] struct tray_menu *item);
32
37 void tray_donate_github_cb([[maybe_unused]] struct tray_menu *item);
38
43 void tray_donate_patreon_cb([[maybe_unused]] struct tray_menu *item);
44
49 void tray_donate_paypal_cb([[maybe_unused]] struct tray_menu *item);
50
51#if defined(_WIN32) || defined(__APPLE__)
56 void tray_virtualhid_license_cb([[maybe_unused]] struct tray_menu *item);
57
62 void tray_virtualhid_download_cb([[maybe_unused]] struct tray_menu *item);
63#endif
64
69 void tray_reset_display_device_config_cb([[maybe_unused]] struct tray_menu *item);
70
75 void tray_restart_cb([[maybe_unused]] struct tray_menu *item);
76
81 void tray_quit_cb([[maybe_unused]] struct tray_menu *item);
82
87 int init_tray();
88
94
100 void run_tray_until_exit(const std::shared_ptr<safe::event_t<bool>> &shutdown_event);
101
106 int end_tray();
107
112 void update_tray_playing(std::string app_name);
113
118 void update_tray_pausing(std::string app_name);
119
124 void update_tray_stopped(std::string app_name);
125
130
131#if defined(_WIN32) || defined(__APPLE__)
138 void update_tray_virtualhid_license(const lvh::LicenseStatus &license, bool notify_if_unlicensed);
139
144
157 bool installed,
158 std::string_view version,
159 bool version_compatible,
160 std::string_view supported_versions
161 );
162
167#endif
168
173 int init_tray_threaded();
174
175#ifdef SUNSHINE_TESTS
181 const struct tray &tray_data_for_testing();
182
188 bool tray_initialized_for_testing();
189
193 void reset_tray_data_for_testing();
194
201 const char *resource_path_for_testing(const char *relative_path);
202
206 void resolve_tray_icon_paths_for_testing();
207#endif
208} // namespace system_tray
Thread-safe event value that blocks readers until a value is raised.
Definition thread_safe.h:24
Handles the system tray icon and notification system.
Definition system_tray.cpp:90
void tray_donate_github_cb(struct tray_menu *item)
Callback for opening GitHub Sponsors from the system tray.
Definition system_tray.cpp:175
int init_tray()
Initializes the system tray without starting a loop.
Definition system_tray.cpp:808
int init_tray_threaded()
Initializes and runs the system tray in a separate thread.
Definition system_tray.cpp:964
void tray_donate_paypal_cb(struct tray_menu *item)
Callback for opening PayPal donation from the system tray.
Definition system_tray.cpp:183
int process_tray_events()
Processes a single tray event iteration.
Definition system_tray.cpp:812
void update_tray_require_pin()
Spawns a notification for PIN Pairing. Clicking it opens the PIN Web UI Page.
Definition system_tray.cpp:910
void update_tray_virtualhid_driver(const bool installed, const std::string_view version, const bool version_compatible, const std::string_view supported_versions)
Show an update notification for an unsupported Virtual HID Broker.
Definition system_tray.cpp:550
void update_tray_playing(std::string app_name)
Sets the tray icon in playing mode and spawns the appropriate notification.
Definition system_tray.cpp:844
void update_tray_pausing(std::string app_name)
Sets the tray icon in pausing mode (stream stopped but app running) and spawns the appropriate notifi...
Definition system_tray.cpp:866
void prepare_tray_virtualhid_license()
Query the Virtual HID Broker license and prepare the startup tray state.
Definition system_tray.cpp:545
void tray_reset_display_device_config_cb(struct tray_menu *item)
Callback for resetting display device configuration.
Definition system_tray.cpp:228
void tray_restart_cb(struct tray_menu *item)
Callback for restarting Sunshine from the system tray.
Definition system_tray.cpp:234
void update_tray_virtualhid_license(const lvh::LicenseStatus &license, const bool notify_if_unlicensed)
Update the Virtual HID Broker license submenu and optional notification.
Definition system_tray.cpp:498
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.
Definition system_tray.cpp:822
void tray_open_ui_cb(struct tray_menu *item)
Callback for opening the UI from the system tray.
Definition system_tray.cpp:170
void tray_quit_cb(struct tray_menu *item)
Callback for exiting Sunshine from the system tray.
Definition system_tray.cpp:240
void prepare_tray_virtualhid_driver()
Query the Virtual HID Broker version and prepare its startup notification.
Definition system_tray.cpp:588
int end_tray()
Exit the system tray.
Definition system_tray.cpp:827
void tray_virtualhid_license_cb(struct tray_menu *item)
Callback for opening Virtual HID Broker license settings in the Web UI.
Definition system_tray.cpp:188
void update_tray_stopped(std::string app_name)
Sets the tray icon in stopped mode (app and stream stopped) and spawns the appropriate notification.
Definition system_tray.cpp:888
void tray_donate_patreon_cb(struct tray_menu *item)
Callback for opening Patreon from the system tray.
Definition system_tray.cpp:179
void tray_virtualhid_download_cb(struct tray_menu *item)
Callback for opening the latest Virtual HID Broker release.
Definition system_tray.cpp:197