2023-03-15 16:30:18 -04:00
|
|
|
/**
|
2023-05-07 18:12:39 -04:00
|
|
|
* @file src/system_tray.h
|
2024-06-28 08:34:14 -04:00
|
|
|
* @brief Declarations for the system tray icon and notification system.
|
2023-04-26 09:27:08 -04:00
|
|
|
*/
|
2023-05-07 15:01:44 -04:00
|
|
|
#pragma once
|
2023-04-27 10:19:33 -04:00
|
|
|
|
2024-06-28 08:34:14 -04:00
|
|
|
/**
|
|
|
|
* @brief Handles the system tray icon and notification system.
|
|
|
|
*/
|
2023-03-15 16:30:18 -04:00
|
|
|
namespace system_tray {
|
2024-06-28 08:34:14 -04:00
|
|
|
/**
|
|
|
|
* @brief Callback for opening the UI from the system tray.
|
|
|
|
* @param item The tray menu item.
|
|
|
|
*/
|
2023-03-27 21:45:29 -04:00
|
|
|
void
|
|
|
|
tray_open_ui_cb(struct tray_menu *item);
|
2024-06-28 08:34:14 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Callback for opening GitHub Sponsors from the system tray.
|
|
|
|
* @param item The tray menu item.
|
|
|
|
*/
|
2023-03-27 21:45:29 -04:00
|
|
|
void
|
|
|
|
tray_donate_github_cb(struct tray_menu *item);
|
2024-06-28 08:34:14 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Callback for opening Patreon from the system tray.
|
|
|
|
* @param item The tray menu item.
|
|
|
|
*/
|
2023-03-27 21:45:29 -04:00
|
|
|
void
|
|
|
|
tray_donate_patreon_cb(struct tray_menu *item);
|
2024-06-28 08:34:14 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Callback for opening PayPal donation from the system tray.
|
|
|
|
* @param item The tray menu item.
|
|
|
|
*/
|
2023-03-27 21:45:29 -04:00
|
|
|
void
|
|
|
|
tray_donate_paypal_cb(struct tray_menu *item);
|
2024-06-28 08:34:14 -04:00
|
|
|
|
2025-01-17 18:45:50 +02:00
|
|
|
/**
|
|
|
|
* @brief Callback for resetting display device configuration.
|
|
|
|
* @param item The tray menu item.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
tray_reset_display_device_config_cb(struct tray_menu *item);
|
|
|
|
|
2024-06-28 08:34:14 -04:00
|
|
|
/**
|
|
|
|
* @brief Callback for restarting Sunshine from the system tray.
|
|
|
|
* @param item The tray menu item.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
tray_restart_cb(struct tray_menu *item);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Callback for exiting Sunshine from the system tray.
|
|
|
|
* @param item The tray menu item.
|
|
|
|
*/
|
2023-03-27 21:45:29 -04:00
|
|
|
void
|
|
|
|
tray_quit_cb(struct tray_menu *item);
|
2023-03-15 16:30:18 -04:00
|
|
|
|
2024-06-28 08:34:14 -04:00
|
|
|
/**
|
|
|
|
* @brief Create the system tray.
|
|
|
|
* @details This function has an endless loop, so it should be run in a separate thread.
|
|
|
|
* @return 1 if the system tray failed to create, otherwise 0 once the tray has been terminated.
|
|
|
|
*/
|
2023-03-27 21:45:29 -04:00
|
|
|
int
|
|
|
|
system_tray();
|
2024-06-28 08:34:14 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Run the system tray with platform specific options.
|
|
|
|
* @todo macOS requires that UI elements be created on the main thread, so the system tray is not currently implemented for macOS.
|
|
|
|
*/
|
2023-03-27 21:45:29 -04:00
|
|
|
int
|
|
|
|
run_tray();
|
2024-06-28 08:34:14 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Exit the system tray.
|
|
|
|
* @return 0 after exiting the system tray.
|
|
|
|
*/
|
2023-03-27 21:45:29 -04:00
|
|
|
int
|
|
|
|
end_tray();
|
2024-06-28 08:34:14 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sets the tray icon in playing mode and spawns the appropriate notification
|
|
|
|
* @param app_name The started application name
|
|
|
|
*/
|
2023-09-16 00:48:51 +00:00
|
|
|
void
|
|
|
|
update_tray_playing(std::string app_name);
|
2024-06-28 08:34:14 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sets the tray icon in pausing mode (stream stopped but app running) and spawns the appropriate notification
|
|
|
|
* @param app_name The paused application name
|
|
|
|
*/
|
2023-09-16 00:48:51 +00:00
|
|
|
void
|
|
|
|
update_tray_pausing(std::string app_name);
|
2024-06-28 08:34:14 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sets the tray icon in stopped mode (app and stream stopped) and spawns the appropriate notification
|
|
|
|
* @param app_name The started application name
|
|
|
|
*/
|
2023-09-16 00:48:51 +00:00
|
|
|
void
|
|
|
|
update_tray_stopped(std::string app_name);
|
2024-06-28 08:34:14 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Spawns a notification for PIN Pairing. Clicking it opens the PIN Web UI Page
|
|
|
|
*/
|
2023-09-16 00:48:51 +00:00
|
|
|
void
|
|
|
|
update_tray_require_pin();
|
2023-03-27 21:45:29 -04:00
|
|
|
} // namespace system_tray
|