feat(tray): add button to reset display device settings on Windows (#3546)

This commit is contained in:
Lukas Senionis
2025-01-17 18:45:50 +02:00
committed by GitHub
parent 1c2d7ec830
commit bc22cca59b
2 changed files with 19 additions and 0 deletions
+12
View File
@@ -37,6 +37,7 @@
// local includes // local includes
#include "confighttp.h" #include "confighttp.h"
#include "display_device.h"
#include "logging.h" #include "logging.h"
#include "platform/common.h" #include "platform/common.h"
#include "process.h" #include "process.h"
@@ -70,6 +71,13 @@ namespace system_tray {
platf::open_url("https://www.paypal.com/paypalme/ReenigneArcher"); platf::open_url("https://www.paypal.com/paypalme/ReenigneArcher");
} }
void
tray_reset_display_device_config_cb(struct tray_menu *item) {
BOOST_LOG(info) << "Resetting display device config from system tray"sv;
std::ignore = display_device::reset_persistence();
}
void void
tray_restart_cb(struct tray_menu *item) { tray_restart_cb(struct tray_menu *item) {
BOOST_LOG(info) << "Restarting from system tray"sv; BOOST_LOG(info) << "Restarting from system tray"sv;
@@ -110,6 +118,10 @@ namespace system_tray {
{ .text = "PayPal", .cb = tray_donate_paypal_cb }, { .text = "PayPal", .cb = tray_donate_paypal_cb },
{ .text = nullptr } } }, { .text = nullptr } } },
{ .text = "-" }, { .text = "-" },
// Currently display device settings are only supported on Windows
#ifdef _WIN32
{ .text = "Reset Display Device Config", .cb = tray_reset_display_device_config_cb },
#endif
{ .text = "Restart", .cb = tray_restart_cb }, { .text = "Restart", .cb = tray_restart_cb },
{ .text = "Quit", .cb = tray_quit_cb }, { .text = "Quit", .cb = tray_quit_cb },
{ .text = nullptr } }, { .text = nullptr } },
+7
View File
@@ -36,6 +36,13 @@ namespace system_tray {
void void
tray_donate_paypal_cb(struct tray_menu *item); tray_donate_paypal_cb(struct tray_menu *item);
/**
* @brief Callback for resetting display device configuration.
* @param item The tray menu item.
*/
void
tray_reset_display_device_config_cb(struct tray_menu *item);
/** /**
* @brief Callback for restarting Sunshine from the system tray. * @brief Callback for restarting Sunshine from the system tray.
* @param item The tray menu item. * @param item The tray menu item.