Skip to content

Commit

Permalink
feat(tray): add button to reset display device settings on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
FrogTheFrog committed Jan 17, 2025
1 parent fb557df commit 67d9e25
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/system_tray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

// local includes
#include "confighttp.h"
#include "display_device.h"
#include "logging.h"
#include "platform/common.h"
#include "process.h"
Expand Down Expand Up @@ -70,6 +71,13 @@ namespace system_tray {
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
tray_restart_cb(struct tray_menu *item) {
BOOST_LOG(info) << "Restarting from system tray"sv;
Expand Down Expand Up @@ -110,6 +118,10 @@ namespace system_tray {
{ .text = "PayPal", .cb = tray_donate_paypal_cb },
{ .text = nullptr } } },
{ .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 = "Quit", .cb = tray_quit_cb },
{ .text = nullptr } },
Expand Down
7 changes: 7 additions & 0 deletions src/system_tray.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ namespace system_tray {
void
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.
* @param item The tray menu item.
Expand Down

0 comments on commit 67d9e25

Please sign in to comment.