Event Ballons and Tray Icon improvements (#1561)

Co-authored-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
This commit is contained in:
Elia Zammuto
2023-09-16 00:48:51 +00:00
committed by GitHub
parent fa7c16bd11
commit dc967ccc7b
27 changed files with 415 additions and 11 deletions

View File

@ -24,6 +24,7 @@
#include "crypto.h"
#include "main.h"
#include "platform/common.h"
#include "system_tray.h"
#include "utility.h"
#ifdef _WIN32
@ -116,7 +117,6 @@ namespace proc {
_app_id = app_id;
_app = *iter;
_app_prep_begin = std::begin(_app.prep_cmds);
_app_prep_it = _app_prep_begin;
@ -244,9 +244,8 @@ namespace proc {
void
proc_t::terminate() {
bool has_run = _app_id > 0;
std::error_code ec;
// Ensure child process is terminated
placebo = false;
process_end(_process, _process_handle);
_process = bp::child();
@ -279,6 +278,13 @@ namespace proc {
}
_pipe.reset();
#if defined SUNSHINE_TRAY && SUNSHINE_TRAY >= 1
// Only show the Stopped notification if we actually have an app to stop
// Since terminate() is always run when a new app has started
if (proc::proc.get_last_run_app_name().length() > 0 && has_run) {
system_tray::update_tray_stopped(proc::proc.get_last_run_app_name());
}
#endif
}
const std::vector<ctx_t> &
@ -304,6 +310,11 @@ namespace proc {
return validate_app_image_path(app_image_path);
}
std::string
proc_t::get_last_run_app_name() {
return _app.name;
}
proc_t::~proc_t() {
// It's not safe to call terminate() here because our proc_t is a static variable
// that may be destroyed after the Boost loggers have been destroyed. Instead,