mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[Workspaces] Close editor when PT runner exited. (#34477)
* [Workspaces] Close editor when PT runner exited. * removed trailing whitespace
This commit is contained in:
@@ -57,6 +57,20 @@ namespace WorkspacesEditor
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var args = e?.Args;
|
||||||
|
int powerToysRunnerPid;
|
||||||
|
if (args?.Length > 0)
|
||||||
|
{
|
||||||
|
_ = int.TryParse(args[0], out powerToysRunnerPid);
|
||||||
|
|
||||||
|
Logger.LogInfo($"WorkspacesEditor started from the PowerToys Runner. Runner pid={powerToysRunnerPid}");
|
||||||
|
RunnerHelper.WaitForPowerToysRunner(powerToysRunnerPid, () =>
|
||||||
|
{
|
||||||
|
Logger.LogInfo("PowerToys Runner exited. Exiting WorkspacesEditor");
|
||||||
|
Dispatcher.Invoke(Shutdown);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
ThemeManager = new ThemeManager(this);
|
ThemeManager = new ThemeManager(this);
|
||||||
|
|
||||||
if (_mainViewModel == null)
|
if (_mainViewModel == null)
|
||||||
|
|||||||
@@ -309,15 +309,15 @@ private:
|
|||||||
{
|
{
|
||||||
Logger::trace(L"Starting Workspaces Editor");
|
Logger::trace(L"Starting Workspaces Editor");
|
||||||
|
|
||||||
/*unsigned long powertoys_pid = GetCurrentProcessId();
|
unsigned long powertoys_pid = GetCurrentProcessId();
|
||||||
std::wstring executable_args = L"";
|
std::wstring executable_args = L"";
|
||||||
executable_args.append(std::to_wstring(powertoys_pid));*/
|
executable_args.append(std::to_wstring(powertoys_pid));
|
||||||
|
|
||||||
SHELLEXECUTEINFOW sei{ sizeof(sei) };
|
SHELLEXECUTEINFOW sei{ sizeof(sei) };
|
||||||
sei.fMask = SEE_MASK_NOCLOSEPROCESS;
|
sei.fMask = SEE_MASK_NOCLOSEPROCESS;
|
||||||
sei.lpFile = L"PowerToys.WorkspacesEditor.exe";
|
sei.lpFile = L"PowerToys.WorkspacesEditor.exe";
|
||||||
sei.nShow = SW_SHOWNORMAL;
|
sei.nShow = SW_SHOWNORMAL;
|
||||||
//sei.lpParameters = executable_args.data();
|
sei.lpParameters = executable_args.data();
|
||||||
if (ShellExecuteExW(&sei))
|
if (ShellExecuteExW(&sei))
|
||||||
{
|
{
|
||||||
Logger::trace("Successfully started the Workspaces Editor");
|
Logger::trace("Successfully started the Workspaces Editor");
|
||||||
|
|||||||
Reference in New Issue
Block a user