Release v0.6.11: show branded update progress and completion

This commit is contained in:
2026-10-29 23:03:06 +02:00
parent 8b5f632ad7
commit c326db7dc5
13 changed files with 290 additions and 28 deletions
+3 -3
View File
@@ -1387,7 +1387,7 @@ void App::checkUpdate(bool interactive, bool install, const std::wstring &versio
updateWorker = std::thread([this, interactive, install, version]
{
auto result = std::make_unique<UpdateResult>();
try { *result = runUpdate(install, version); }
try { *result = runUpdate(install, version, interactive); }
catch (const std::exception &e) { result->state = L"error"; result->error = wide(e.what()); }
result->interactive = interactive;
result->install = install;
@@ -1635,8 +1635,8 @@ int App::execute()
SetTimer(window, 2, 10000, nullptr);
else
SetTimer(window, 5, 5000, nullptr);
if (keyboardHook && mouseHook)
confirmUpdatedStartup(updateStartupEvent);
if (keyboardHook && mouseHook && confirmUpdatedStartup(updateStartupEvent))
log(std::wstring(L"Update completed; running version ") + AppVersion);
if (startCommand)
PostMessageW(window, WM_HOTKEY, startCommand, 0);
try { registerScreenshotNotifications(); }
+5 -4
View File
@@ -26,7 +26,7 @@ std::wstring quoteArgument(const std::wstring &value)
return out + L'"';
}
}
UpdateResult runUpdate(bool install, const std::wstring &expectedVersion)
UpdateResult runUpdate(bool install, const std::wstring &expectedVersion, bool showProgress)
{
UpdateResult result;
GUID guid{};
@@ -56,6 +56,7 @@ UpdateResult runUpdate(bool install, const std::wstring &expectedVersion)
L" -InstallDirectory " + quoteArgument(std::filesystem::path(executable()).parent_path().wstring()) +
L" -ParentProcessId " + std::to_wstring(GetCurrentProcessId()) + L" -ReadyEvent " + quoteArgument(readyName);
if (install) command += L" -ExpectedVersion " + quoteArgument(expectedVersion);
if (showProgress) command += L" -ShowProgress";
STARTUPINFOW startup{sizeof(startup)};
PROCESS_INFORMATION process{};
if (!CreateProcessW(powershell.c_str(), command.data(), nullptr, nullptr, FALSE, CREATE_NO_WINDOW,
@@ -94,10 +95,10 @@ UpdateResult runUpdate(bool install, const std::wstring &expectedVersion)
throw;
}
}
void confirmUpdatedStartup(const std::wstring &eventName)
bool confirmUpdatedStartup(const std::wstring &eventName)
{
if (!eventName.starts_with(L"Local\\KSwitcher.Update.Started.")) return;
if (!eventName.starts_with(L"Local\\KSwitcher.Update.Started.")) return false;
Handle event{OpenEventW(EVENT_MODIFY_STATE, FALSE, eventName.c_str())};
if (event.value) SetEvent(event.value);
return event.value && SetEvent(event.value);
}
}
+3 -3
View File
@@ -2,7 +2,7 @@
#include "platform.h"
namespace ks
{
inline constexpr wchar_t AppVersion[] = L"0.6.10";
inline constexpr wchar_t AppVersion[] = L"0.6.11";
inline constexpr UINT UpdateMessage = WM_APP + 7;
inline constexpr UINT UpdateCheckIntervalMs = 6 * 60 * 60 * 1000;
inline constexpr UINT UpdateNotificationRetryMs = 5 * 60 * 1000;
@@ -13,6 +13,6 @@ struct UpdateResult
std::wstring state, version, error;
bool interactive{}, install{};
};
UpdateResult runUpdate(bool install, const std::wstring &expectedVersion);
void confirmUpdatedStartup(const std::wstring &eventName);
UpdateResult runUpdate(bool install, const std::wstring &expectedVersion, bool showProgress = false);
bool confirmUpdatedStartup(const std::wstring &eventName);
}