Add force close option on tray menu

This commit is contained in:
Yukino Song
2024-07-30 01:29:43 +08:00
parent ad57d08b37
commit 73bc060908
2 changed files with 20 additions and 10 deletions

View File

@@ -75,6 +75,12 @@ namespace system_tray {
platf::open_url("https://www.paypal.com/paypalme/ReenigneArcher");
}
void
tray_force_stop_cb(struct tray_menu *item) {
BOOST_LOG(info) << "Force stop from system tray"sv;
proc::proc.terminate();
}
void
tray_restart_cb(struct tray_menu *item) {
BOOST_LOG(info) << "Restarting from system tray"sv;
@@ -106,16 +112,17 @@ namespace system_tray {
(struct tray_menu[]) {
// todo - use boost/locale to translate menu strings
{ .text = "Open Sunshine", .cb = tray_open_ui_cb },
{ .text = "-" },
{ .text = "Donate",
.submenu =
(struct tray_menu[]) {
{ .text = "GitHub Sponsors", .cb = tray_donate_github_cb },
{ .text = "MEE6", .cb = tray_donate_mee6_cb },
{ .text = "Patreon", .cb = tray_donate_patreon_cb },
{ .text = "PayPal", .cb = tray_donate_paypal_cb },
{ .text = nullptr } } },
{ .text = "-" },
// { .text = "-" },
// { .text = "Donate",
// .submenu =
// (struct tray_menu[]) {
// { .text = "GitHub Sponsors", .cb = tray_donate_github_cb },
// { .text = "MEE6", .cb = tray_donate_mee6_cb },
// { .text = "Patreon", .cb = tray_donate_patreon_cb },
// { .text = "PayPal", .cb = tray_donate_paypal_cb },
// { .text = nullptr } } },
// { .text = "-" },
{ .text = "Force Close", .cb = tray_force_stop_cb },
{ .text = "Restart", .cb = tray_restart_cb },
{ .text = "Quit", .cb = tray_quit_cb },
{ .text = nullptr } },

View File

@@ -43,6 +43,9 @@ namespace system_tray {
void
tray_donate_paypal_cb(struct tray_menu *item);
void
tray_force_stop_cb(struct tray_menu *item);
/**
* @brief Callback for restarting Sunshine from the system tray.
* @param item The tray menu item.