feat(tray): Add runtime config option to enable/disable system tray (#4208)
This commit is contained in:
@@ -261,6 +261,29 @@ editing the `conf` file in a text editor. Use the examples as reference.
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
### system_tray
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>Description</td>
|
||||||
|
<td colspan="2">
|
||||||
|
Show icon in system tray and display desktop notifications
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Default</td>
|
||||||
|
<td colspan="2">@code{}
|
||||||
|
enabled
|
||||||
|
@endcode</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Example</td>
|
||||||
|
<td colspan="2">@code{}
|
||||||
|
system_tray = enabled
|
||||||
|
@endcode</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
## Input
|
## Input
|
||||||
|
|
||||||
### controller
|
### controller
|
||||||
|
|||||||
@@ -578,6 +578,7 @@ namespace config {
|
|||||||
"ipv4", // Address family
|
"ipv4", // Address family
|
||||||
platf::appdata().string() + "/sunshine.log", // log file
|
platf::appdata().string() + "/sunshine.log", // log file
|
||||||
false, // notify_pre_releases
|
false, // notify_pre_releases
|
||||||
|
true, // system_tray
|
||||||
{}, // prep commands
|
{}, // prep commands
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1229,6 +1230,7 @@ namespace config {
|
|||||||
bool_f(vars, "native_pen_touch", input.native_pen_touch);
|
bool_f(vars, "native_pen_touch", input.native_pen_touch);
|
||||||
|
|
||||||
bool_f(vars, "notify_pre_releases", sunshine.notify_pre_releases);
|
bool_f(vars, "notify_pre_releases", sunshine.notify_pre_releases);
|
||||||
|
bool_f(vars, "system_tray", sunshine.system_tray);
|
||||||
|
|
||||||
int port = sunshine.port;
|
int port = sunshine.port;
|
||||||
int_between_f(vars, "port"s, port, {1024 + nvhttp::PORT_HTTPS, 65535 - rtsp_stream::RTSP_SETUP_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;
|
std::string log_file;
|
||||||
bool notify_pre_releases;
|
bool notify_pre_releases;
|
||||||
|
bool system_tray;
|
||||||
std::vector<prep_cmd_t> prep_cmds;
|
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) {
|
while (true) {
|
||||||
if (shutdown_event->peek()) {
|
if (shutdown_event->peek()) {
|
||||||
BOOST_LOG(info) << "Shutdown event detected, breaking main loop"sv;
|
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();
|
system_tray::end_tray();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -384,7 +384,7 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (tray_is_enabled) {
|
if (tray_is_enabled && config::sunshine.system_tray) {
|
||||||
BOOST_LOG(info) << "Starting system tray"sv;
|
BOOST_LOG(info) << "Starting system tray"sv;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// TODO: Windows has a weird bug where when running as a service and on the first Windows boot,
|
// 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
|
// 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();
|
system_tray::end_tray_threaded();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -136,6 +136,7 @@
|
|||||||
"min_log_level": 2,
|
"min_log_level": 2,
|
||||||
"global_prep_cmd": [],
|
"global_prep_cmd": [],
|
||||||
"notify_pre_releases": "disabled",
|
"notify_pre_releases": "disabled",
|
||||||
|
"system_tray": "enabled",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -133,6 +133,14 @@ function removeCmd(index) {
|
|||||||
v-model="config.notify_pre_releases"
|
v-model="config.notify_pre_releases"
|
||||||
default="false"
|
default="false"
|
||||||
></Checkbox>
|
></Checkbox>
|
||||||
|
|
||||||
|
<!-- Enable system tray -->
|
||||||
|
<Checkbox class="mb-3"
|
||||||
|
id="system_tray"
|
||||||
|
locale-prefix="config"
|
||||||
|
v-model="config.system_tray"
|
||||||
|
default="true"
|
||||||
|
></Checkbox>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -355,6 +355,8 @@
|
|||||||
"sw_tune_grain": "grain -- preserves the grain structure in old, grainy film material",
|
"sw_tune_grain": "grain -- preserves the grain structure in old, grainy film material",
|
||||||
"sw_tune_stillimage": "stillimage -- good for slideshow-like content",
|
"sw_tune_stillimage": "stillimage -- good for slideshow-like content",
|
||||||
"sw_tune_zerolatency": "zerolatency -- good for fast encoding and low-latency streaming (default)",
|
"sw_tune_zerolatency": "zerolatency -- good for fast encoding and low-latency streaming (default)",
|
||||||
|
"system_tray": "Enable system tray",
|
||||||
|
"system_tray_desc": "Show icon in system tray and display desktop notifications",
|
||||||
"touchpad_as_ds4": "Emulate a DS4 gamepad if the client gamepad reports a touchpad is present",
|
"touchpad_as_ds4": "Emulate a DS4 gamepad if the client gamepad reports a touchpad is present",
|
||||||
"touchpad_as_ds4_desc": "If disabled, touchpad presence will not be taken into account during gamepad type selection.",
|
"touchpad_as_ds4_desc": "If disabled, touchpad presence will not be taken into account during gamepad type selection.",
|
||||||
"upnp": "UPnP",
|
"upnp": "UPnP",
|
||||||
|
|||||||
Reference in New Issue
Block a user