feat(tray): Add runtime config option to enable/disable system tray (#4208)
This commit is contained in:
parent
73f84fb6dd
commit
8bff4d0780
7 changed files with 40 additions and 3 deletions
|
|
@ -578,6 +578,7 @@ namespace config {
|
|||
"ipv4", // Address family
|
||||
platf::appdata().string() + "/sunshine.log", // log file
|
||||
false, // notify_pre_releases
|
||||
true, // system_tray
|
||||
{}, // prep commands
|
||||
};
|
||||
|
||||
|
|
@ -1229,6 +1230,7 @@ namespace config {
|
|||
bool_f(vars, "native_pen_touch", input.native_pen_touch);
|
||||
|
||||
bool_f(vars, "notify_pre_releases", sunshine.notify_pre_releases);
|
||||
bool_f(vars, "system_tray", sunshine.system_tray);
|
||||
|
||||
int port = sunshine.port;
|
||||
int_between_f(vars, "port"s, port, {1024 + nvhttp::PORT_HTTPS, 65535 - rtsp_stream::RTSP_SETUP_PORT});
|
||||
|
|
|
|||
|
|
@ -256,6 +256,7 @@ namespace config {
|
|||
|
||||
std::string log_file;
|
||||
bool notify_pre_releases;
|
||||
bool system_tray;
|
||||
std::vector<prep_cmd_t> prep_cmds;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ void mainThreadLoop(const std::shared_ptr<safe::event_t<bool>> &shutdown_event)
|
|||
while (true) {
|
||||
if (shutdown_event->peek()) {
|
||||
BOOST_LOG(info) << "Shutdown event detected, breaking main loop"sv;
|
||||
if (tray_is_enabled) {
|
||||
if (tray_is_enabled && config::sunshine.system_tray) {
|
||||
system_tray::end_tray();
|
||||
}
|
||||
break;
|
||||
|
|
@ -384,7 +384,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
#endif
|
||||
|
||||
if (tray_is_enabled) {
|
||||
if (tray_is_enabled && config::sunshine.system_tray) {
|
||||
BOOST_LOG(info) << "Starting system tray"sv;
|
||||
#ifdef _WIN32
|
||||
// TODO: Windows has a weird bug where when running as a service and on the first Windows boot,
|
||||
|
|
@ -418,7 +418,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
// Stop the threaded tray if it was started
|
||||
if (tray_is_enabled) {
|
||||
if (tray_is_enabled && config::sunshine.system_tray) {
|
||||
system_tray::end_tray_threaded();
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue