From 3bcbfeee1595d52a259e6944a398dd32fd83dadb Mon Sep 17 00:00:00 2001 From: Anatolii Hrynchuk Date: Fri, 13 Nov 2026 10:28:41 +0200 Subject: [PATCH] Release KSwitcher v0.6.73 with autostart path repair --- CMakeLists.txt | 2 +- README.md | 10 ++- Release/README.md | 16 +++++ Release/SHA256SUMS.txt | 2 +- Release/release-files.json | 74 ++++++++++---------- resources/app.rc | 6 +- src/app.cpp | 57 +++++++++++++++ src/app.h | 2 + src/autostart.cpp | 138 +++++++++++++++++++++++++++++++++---- src/main.cpp | 13 +++- src/platform.h | 2 + src/ui.cpp | 4 +- src/update.h | 2 +- 13 files changed, 265 insertions(+), 63 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e30a7bd..7d45f39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.24) -project(KSwitcher VERSION 0.6.72 LANGUAGES CXX RC) +project(KSwitcher VERSION 0.6.73 LANGUAGES CXX RC) if(NOT WIN32) message(FATAL_ERROR "KSwitcher uses native Windows APIs") endif() diff --git a/README.md b/README.md index 9ee63e5..c1a1cef 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ Double-click the tray icon to open Settings, the bold default menu item. Closing Settings with unsaved changes (including accepted auto-correction or OCR options) asks whether to save, discard changes, or keep editing. Unchanged settings close without a prompt. If saving fails, the window stays open with your edits intact. -Settings displays **No unsaved changes** with **Save** disabled until an edit is made. +Settings displays **No unsaved settings** when the draft matches the saved settings. If **Start with Windows** is enabled, **Save** remains available to recheck the autostart path. The Computers window applies and saves network changes immediately, separately from Settings. Pairing shows the target computer and remaining wait time; enter the same code and click **Pair** on both PCs. The code stays visible for copying or retry until the pair is saved. A saved pair still requires input sharing to be enabled on both PCs. @@ -164,8 +164,12 @@ the elevated task requests UAC approval if the app is not already elevated. No p the task runs in the signed-in user's interactive session, including on battery power. With both options enabled, opening the regular `KSwitcher.exe` after exiting a development build requests administrator approval if needed. Development builds keep their current launch privileges. -Disabling the administrator option restores ordinary per-user startup; disabling startup stops -future automatic launches. Saving unrelated settings does not recreate startup entries. +Disabling the administrator option restores ordinary per-user startup. Disabling startup stops +future automatic launches. On launch and after clicking **Save** in Settings, KSwitcher checks whether the +enabled autostart entry still points to its current location. If the previous file is missing and +KSwitcher has the required privileges, it updates the path automatically. If the previous path may +still be in use or the repair requires administrator approval, KSwitcher shows both paths and asks +before updating the entry. `KSwitcher.exe --settings` opens Settings, including when the app is already running. Exit [Typlo](https://github.com/bitcodepro/Typlo) when using overlapping shortcuts to avoid competing keyboard hooks. diff --git a/Release/README.md b/Release/README.md index 42279a7..0129a7a 100644 --- a/Release/README.md +++ b/Release/README.md @@ -1,5 +1,21 @@ # Latest Windows release +## v0.6.73 — 2026-11-13 + +After moving KSwitcher, launch it from its current folder. If Windows autostart +still points to the old location, KSwitcher updates the path automatically when +the previous executable is missing and the process has sufficient rights. If +the previous copy may still be in use or the repair needs administrator approval, +choose **Update autostart path** and confirm UAC if prompted. To check again, +click **Save** in Settings without changing the autostart options. + +**Українською.** Після перенесення KSwitcher запустіть його з нової папки. +Якщо автозапуск і далі вказує на старий шлях, KSwitcher виправить його +автоматично, коли старий файл відсутній і прав достатньо. Якщо стара копія +ще може використовуватися або потрібні права адміністратора, натисніть +**Update autostart path** і підтвердьте UAC, якщо з’явиться запит. Для повторної +перевірки натисніть **Save** у налаштуваннях без зміни параметрів автозапуску. + ## v0.6.72 — 2026-11-12 Edit snippets directly in **Settings → Snippets**. **Save snippets** applies diff --git a/Release/SHA256SUMS.txt b/Release/SHA256SUMS.txt index 31b70f7..a5a6be5 100644 --- a/Release/SHA256SUMS.txt +++ b/Release/SHA256SUMS.txt @@ -1 +1 @@ -4b694cdc1d32da0623bb3372b0c04d438f70c427baac1ef831b94c8f492df8d0 KSwitcher-win-x64.zip +5e47e81f7e96ef0c32d4f6322d8463f4f30b49e44da20052d8351c81b2451867 KSwitcher-win-x64.zip diff --git a/Release/release-files.json b/Release/release-files.json index 53d1242..191a67c 100644 --- a/Release/release-files.json +++ b/Release/release-files.json @@ -1,86 +1,86 @@ { - "schema": 1, - "version": "0.6.72", + "version": "0.6.73", "files": [ { - "size": 2202624, - "sha256": "59b7072ac1cb0e7e138fc89b5cf3776a5affee47cb374c1f825411a71742f6fe", - "path": "KSwitcher.exe" + "size": 2208256, + "path": "KSwitcher.exe", + "sha256": "9c03c121f81221fb2455dd87a13cba27d2870539e323792371d2874ac0ae92a5" }, { "size": 2130432, - "sha256": "1cab608710db9de62ef7726a7cca30e1284377871fce9674a4815399bb2f0211", - "path": "KSwitcher.Config.exe" + "path": "KSwitcher.Config.exe", + "sha256": "07f18fd579c74b11ebf5cdf8fea27f827cc63de9cccf1402e2f6f87edc9a5269" }, { "size": 3210240, - "sha256": "235afacecc4282baf3388aaecd2a217ae7fbf1aa5800e5193c6552461df30c1f", - "path": "KSwitcher.Screenshot.exe" + "path": "KSwitcher.Screenshot.exe", + "sha256": "c426684eb1b081da81adf16f4ccfc3c4a684ce1aae5feb5a75448165ba64b493" }, { "size": 4401, - "sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c", - "path": "LICENSE" + "path": "LICENSE", + "sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c" }, { "size": 1075, - "sha256": "c0d068392ea65358b798b8c165103560f06e9e3b38c4ab4e2d8810a7b931af86", - "path": "json-LICENSE.txt" + "path": "json-LICENSE.txt", + "sha256": "c0d068392ea65358b798b8c165103560f06e9e3b38c4ab4e2d8810a7b931af86" }, { - "size": 93316, - "sha256": "7475381edfe686f03f08d197d54db34ac12a51bd477cd3b65a57fda32c7852e0", - "path": "README.md" + "size": 93756, + "path": "README.md", + "sha256": "1d1307356a3db561cf3a685eb90b5b524e9e62f9d8acb116a412d5f41242128f" }, { "size": 9908, - "sha256": "4a673e44dc42fff45ba8b944413b5b5adddca7100c7eccd1c5010dccc5762e41", - "path": "LAN-PREVIEW.md" + "path": "LAN-PREVIEW.md", + "sha256": "4a673e44dc42fff45ba8b944413b5b5adddca7100c7eccd1c5010dccc5762e41" }, { "size": 682867, - "sha256": "5f267c141c3d6837870e1c098f86b89a113ba300343119432644ead88f720c21", - "path": "dictionaries/en.txt" + "path": "dictionaries/en.txt", + "sha256": "5f267c141c3d6837870e1c098f86b89a113ba300343119432644ead88f720c21" }, { "size": 20138, - "sha256": "28a9529c7d0bb4dc51f4bf5c116a3d16ef247a052f7591466768ddf563fd1cf5", - "path": "dictionaries/LICENSE-CC-BY-SA-4.0.txt" + "path": "dictionaries/LICENSE-CC-BY-SA-4.0.txt", + "sha256": "28a9529c7d0bb4dc51f4bf5c116a3d16ef247a052f7591466768ddf563fd1cf5" }, { "size": 2230, - "sha256": "2df17fe4e17d527c67ab57269b07dce59a49c1fb128c429a1408decbb47109ec", - "path": "dictionaries/README.md" + "path": "dictionaries/README.md", + "sha256": "2df17fe4e17d527c67ab57269b07dce59a49c1fb128c429a1408decbb47109ec" }, { "size": 1060364, - "sha256": "9ef922c7699569304a428f6aba0fd13a21341c0d0cb9561f37ef83c41577a28b", - "path": "dictionaries/ru.txt" + "path": "dictionaries/ru.txt", + "sha256": "9ef922c7699569304a428f6aba0fd13a21341c0d0cb9561f37ef83c41577a28b" }, { "size": 1279, - "sha256": "d6e11a3aaba22a8a7eaba19f778d8a5bd66653ff306810e85a1b0e7fff3a6b86", - "path": "dictionaries/sources.json" + "path": "dictionaries/sources.json", + "sha256": "d6e11a3aaba22a8a7eaba19f778d8a5bd66653ff306810e85a1b0e7fff3a6b86" }, { "size": 898248, - "sha256": "caeb097749d4afc84b68ad96b3d7dfb6a6569561cd32ccce0bee94a13b43ba86", - "path": "dictionaries/uk.txt" + "path": "dictionaries/uk.txt", + "sha256": "caeb097749d4afc84b68ad96b3d7dfb6a6569561cd32ccce0bee94a13b43ba86" }, { "size": 993, - "sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a", - "path": "tools/README.txt" + "path": "tools/README.txt", + "sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a" }, { "size": 134656, - "sha256": "6ef5cf64708d62b7fc63c3c793cc99188a513433ff4774cae01dc014f6664376", - "path": "tools/StayHere.exe" + "path": "tools/StayHere.exe", + "sha256": "6ef5cf64708d62b7fc63c3c793cc99188a513433ff4774cae01dc014f6664376" }, { "size": 2796, - "sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413", - "path": "tools/StayHere-README.md" + "path": "tools/StayHere-README.md", + "sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413" } - ] + ], + "schema": 1 } diff --git a/resources/app.rc b/resources/app.rc index e963dcd..f190985 100644 --- a/resources/app.rc +++ b/resources/app.rc @@ -9,8 +9,8 @@ IDC_SCREENSHOT_PENCIL CURSOR "icons/lucide/pencil.cur" 1 RT_MANIFEST "app.manifest" 201 RCDATA "update.ps1" 1 VERSIONINFO - FILEVERSION 0,6,72,0 - PRODUCTVERSION 0,6,72,0 + FILEVERSION 0,6,73,0 + PRODUCTVERSION 0,6,73,0 FILEOS VOS_NT_WINDOWS32 FILETYPE VFT_APP BEGIN @@ -20,7 +20,7 @@ BEGIN BEGIN VALUE "FileDescription", "KSwitcher — native keyboard and clipboard utility" VALUE "ProductName", "KSwitcher" - VALUE "FileVersion", "0.6.72" + VALUE "FileVersion", "0.6.73" END END BLOCK "VarFileInfo" diff --git a/src/app.cpp b/src/app.cpp index fbdbf1e..aa52bf4 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include namespace ks @@ -23,6 +24,7 @@ namespace { constexpr UINT SnippetPopupMessage = WM_APP + 81; constexpr UINT SnippetCaretMessage = WM_APP + 82; +constexpr UINT CheckAutostartMessage = WM_APP + 83; constexpr UINT_PTR SnippetPopupTimer = 21; constexpr size_t SnippetVisibleRows = 7; constexpr wchar_t SnippetPopupClass[] = L"KSwitcher.SnippetSuggestions"; @@ -857,6 +859,56 @@ Bytes App::lanCommand(const Bytes &command) void App::applySettings(const Settings &requested) { applySettings(requested, true); + if (settings.autostart && !smoke && !isLocalBuild()) + PostMessageW(window, CheckAutostartMessage, 0, 0); +} + +void App::checkAutostartPath() +{ + if (checkingAutostartPath || !settings.autostart || installingUpdate) + return; + checkingAutostartPath = true; + try + { + const bool elevated = settings.elevatedAutostart; + const auto oldPath = staleAutostartPath(elevated); + if (!oldPath.empty()) + { + const auto attributes = GetFileAttributesW(oldPath.c_str()); + const auto error = attributes == INVALID_FILE_ATTRIBUTES ? GetLastError() : ERROR_SUCCESS; + const bool missingFile = error == ERROR_FILE_NOT_FOUND || error == ERROR_PATH_NOT_FOUND; + const bool needsApproval = elevated && !IsUserAnAdmin(); + bool approved = missingFile && !needsApproval; + if (!approved) + { + const auto text = L"Registered path:\n" + oldPath + L"\n\nCurrent path:\n" + executable() + + (needsApproval ? L"\n\nWindows will ask for administrator approval." : L""); + const TASKDIALOG_BUTTON update{IDYES, L"Update autostart path"}; + TASKDIALOGCONFIG dialog{sizeof(dialog)}; + dialog.dwFlags = TDF_ALLOW_DIALOG_CANCELLATION; + dialog.dwCommonButtons = TDCBF_CANCEL_BUTTON; + dialog.pszWindowTitle = L"KSwitcher"; + dialog.pszMainInstruction = L"Windows autostart points to a different copy of KSwitcher"; + dialog.pszContent = text.c_str(); + dialog.cButtons = 1; + dialog.pButtons = &update; + dialog.nDefaultButton = IDCANCEL; + int button{}; + approved = SUCCEEDED(TaskDialogIndirect(&dialog, &button, nullptr, nullptr)) && button == IDYES; + } + if (approved && settings.autostart && settings.elevatedAutostart == elevated && + !installingUpdate && staleAutostartPath(elevated) == oldPath) + { + repairAutostartPath(elevated); + log(L"Updated Windows autostart path to " + executable()); + } + } + } + catch (const std::exception &e) + { + report(L"Windows autostart: " + wide(e.what())); + } + checkingAutostartPath = false; } void App::applySettings(const Settings &requested, bool validateOcrInstallation) { @@ -3008,6 +3060,9 @@ LRESULT CALLBACK App::windowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) Shell_NotifyIconW(NIM_MODIFY, &icon); return 0; } + case CheckAutostartMessage: + app->checkAutostartPath(); + return 0; case WM_COPYDATA: { auto *data = (COPYDATASTRUCT *)lp; @@ -3238,6 +3293,8 @@ int App::execute() log(std::wstring(L"Update completed; running version ") + AppVersion); if (startCommand) PostMessageW(window, WM_HOTKEY, startCommand, 0); + if (!smoke && !isLocalBuild() && settings.autostart) + PostMessageW(window, CheckAutostartMessage, 0, 0); try { notificationRegistration = startScreenshotNotificationRegistration(); } catch(const std::exception &e) { log(L"Screenshot notification registration: "+wide(e.what())); } auto screenshotActivation=startScreenshotActivationListener(); diff --git a/src/app.h b/src/app.h index 62adc86..be9f725 100644 --- a/src/app.h +++ b/src/app.h @@ -107,6 +107,8 @@ class App friend struct InputRegressionAccess; void releaseIdleMemory(ULONGLONG now); void applySettings(const Settings &, bool validateOcrInstallation); + void checkAutostartPath(); + bool checkingAutostartPath{}; HHOOK keyboardHook{}, mouseHook{}; struct MousePress { diff --git a/src/autostart.cpp b/src/autostart.cpp index f89bf63..8a3bc4e 100644 --- a/src/autostart.cpp +++ b/src/autostart.cpp @@ -27,6 +27,7 @@ template struct Com struct Str { BSTR value; + Str() : value(nullptr) {} Str(const wchar_t *s) : value(SysAllocString(s)) { if (!value) @@ -51,10 +52,108 @@ bool missing(HRESULT hr) { return hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND); } +constexpr wchar_t RunKey[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; + +HRESULT openTaskFolder(Com &service, Com &folder) +{ + HRESULT hr = CoCreateInstance(CLSID_TaskScheduler, nullptr, CLSCTX_INPROC_SERVER, IID_ITaskService, + (void **)service.out()); + VARIANT empty; + VariantInit(&empty); + if (SUCCEEDED(hr)) + hr = service->Connect(empty, empty, empty, empty); + if (SUCCEEDED(hr)) + hr = service->GetFolder(Str(L"\\"), folder.out()); + return hr; +} + +bool sameAccount(const wchar_t *account) +{ + auto sid = currentUserSid(); + if (sid == account) + return true; + DWORD sidSize{}, domainSize{}; + SID_NAME_USE use{}; + LookupAccountNameW(nullptr, account, nullptr, &sidSize, nullptr, &domainSize, &use); + if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) + return false; + Bytes accountSid(sidSize); + std::wstring domain(domainSize, L'\0'); + if (!LookupAccountNameW(nullptr, account, accountSid.data(), &sidSize, domain.data(), &domainSize, &use)) + return false; + LPWSTR accountSidText{}; + if (!ConvertSidToStringSidW(accountSid.data(), &accountSidText)) + return false; + bool same = sid == accountSidText; + LocalFree(accountSidText); + return same; +} + +std::wstring registeredTaskPath() +{ + Com service; + Com folder; + check(openTaskFolder(service, folder)); + Com task; + auto hr = folder->GetTask(Str(L"KSwitcher"), task.out()); + if (missing(hr)) + return {}; + check(hr); + VARIANT_BOOL enabled{}; + check(task->get_Enabled(&enabled)); + if (!enabled) + return {}; + + Com definition; + Com principal; + Str user; + check(task->get_Definition(definition.out())); + check(definition->get_Principal(principal.out())); + check(principal->get_UserId(&user.value)); + if (!user.value || !sameAccount(user.value)) + return {}; + + Com actions; + LONG count{}; + check(definition->get_Actions(actions.out())); + check(actions->get_Count(&count)); + if (count != 1) + return {}; + Com action; + check(actions->get_Item(1, action.out())); + TASK_ACTION_TYPE type{}; + check(action->get_Type(&type)); + if (type != TASK_ACTION_EXEC) + return {}; + Com exec; + Str path, arguments; + check(action->QueryInterface(IID_IExecAction, (void **)exec.out())); + check(exec->get_Arguments(&arguments.value)); + check(exec->get_Path(&path.value)); + return path.value && (!arguments.value || !*arguments.value) ? path.value : L""; +} + +std::wstring registeredRunPath() +{ + DWORD size{}; + auto status = RegGetValueW(HKEY_CURRENT_USER, RunKey, L"KSwitcher", RRF_RT_REG_SZ, nullptr, nullptr, &size); + if (status == ERROR_FILE_NOT_FOUND || status == ERROR_UNSUPPORTED_TYPE) + return {}; + check(HRESULT_FROM_WIN32(status)); + std::wstring command(size / sizeof(wchar_t), L'\0'); + check(HRESULT_FROM_WIN32(RegGetValueW(HKEY_CURRENT_USER, RunKey, L"KSwitcher", RRF_RT_REG_SZ, nullptr, + command.data(), &size))); + command.resize(wcslen(command.c_str())); + // KSwitcher writes a quoted executable path with no arguments. + if (command.size() >= 2 && command.front() == L'"' && command.find(L'"', 1) == command.size() - 1) + return command.substr(1, command.size() - 2); + return {}; +} + void runEntry(bool enabled) { HKEY key{}; - if (RegCreateKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, nullptr, + if (RegCreateKeyExW(HKEY_CURRENT_USER, RunKey, 0, nullptr, 0, KEY_SET_VALUE, nullptr, &key, nullptr) != ERROR_SUCCESS) throw std::runtime_error("Cannot access autostart settings"); auto command = L"\"" + executable() + L"\""; @@ -66,6 +165,27 @@ void runEntry(bool enabled) throw std::runtime_error("Cannot save autostart settings"); } } // namespace +std::wstring staleAutostartPath(bool elevated) +{ + auto registered = elevated ? registeredTaskPath() : registeredRunPath(); + auto path = std::filesystem::path(registered); + if (!path.is_absolute() || _wcsicmp(path.filename().c_str(), L"KSwitcher.exe") != 0) + return {}; + auto current = executable(); + std::error_code error; + if (_wcsicmp(registered.c_str(), current.c_str()) == 0 || std::filesystem::equivalent(path, current, error)) + return {}; + return registered; +} + +void repairAutostartPath(bool elevated) +{ + if (elevated) + setAutostart(true, true); + else + runEntry(true); +} + std::wstring currentUserSid() { HANDLE token{}; @@ -88,13 +208,10 @@ std::wstring currentUserSid() void configureAutostart(int mode) { Com service; - check(CoCreateInstance(CLSID_TaskScheduler, nullptr, CLSCTX_INPROC_SERVER, IID_ITaskService, - (void **)service.out())); + Com folder; + check(openTaskFolder(service, folder)); VARIANT empty; VariantInit(&empty); - check(service->Connect(empty, empty, empty, empty)); - Com folder; - check(service->GetFolder(Str(L"\\"), folder.out())); Com existing; HRESULT found = folder->GetTask(Str(L"KSwitcher"), existing.out()); if (FAILED(found) && !missing(found)) @@ -158,16 +275,9 @@ void setAutostart(bool enabled, bool elevated) if (mode != 2) { Com service; - HRESULT hr = CoCreateInstance(CLSID_TaskScheduler, nullptr, CLSCTX_INPROC_SERVER, IID_ITaskService, - (void **)service.out()); - VARIANT empty; - VariantInit(&empty); Com folder; + HRESULT hr = openTaskFolder(service, folder); Com task; - if (SUCCEEDED(hr)) - hr = service->Connect(empty, empty, empty, empty); - if (SUCCEEDED(hr)) - hr = service->GetFolder(Str(L"\\"), folder.out()); if (SUCCEEDED(hr)) hr = folder->GetTask(Str(L"KSwitcher"), task.out()); if (missing(hr)) diff --git a/src/main.cpp b/src/main.cpp index c394be2..5894642 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,13 +15,24 @@ bool shouldElevateOnLaunch() try { auto settings = ks::loadSettings(ks::dataDirectory() / L"settings.json", {}); - return settings.autostart && settings.elevatedAutostart; + if (!settings.autostart || !settings.elevatedAutostart) + return false; } catch (const std::exception &) { // The normal startup path handles unreadable settings and reports them. return false; } + try + { + // Let the resident explain the stale path before asking to elevate the repair. + return ks::staleAutostartPath(true).empty(); + } + catch (const std::exception &) + { + // The elevated resident can retry reading the task. + return true; + } } } diff --git a/src/platform.h b/src/platform.h index b9ac3aa..8f432ba 100644 --- a/src/platform.h +++ b/src/platform.h @@ -76,6 +76,8 @@ Bytes readFile(const std::filesystem::path &, size_t limit); Bytes protect(const Bytes &); Bytes unprotect(const Bytes &); void setAutostart(bool, bool elevated = false); +std::wstring staleAutostartPath(bool elevated); +void repairAutostartPath(bool elevated); std::wstring currentUserSid(); void configureAutostart(int mode); std::wstring executable(); diff --git a/src/ui.cpp b/src/ui.cpp index d50b5bd..7c9d0dd 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -1711,7 +1711,7 @@ void updateSettingsState(HWND w, SettingsView *v) if (!v || !v->ready || v->filling || v->refreshing) return; v->refreshing = true; bool changed = settingsChanged(w, v); - EnableWindow(GetDlgItem(w, IDOK), changed); + EnableWindow(GetDlgItem(w, IDOK), changed || (v->app->settings.autostart && !isLocalBuild())); const wchar_t *text = changed ? L"Unsaved settings — click Save to apply." : v->visitedLan ? L"No unsaved settings. Network changes save automatically in the Computers window." : L"No unsaved settings."; if (value(w, 261) != text) value(w, 261, text); @@ -1866,7 +1866,7 @@ LRESULT CALLBACK settingsProc(HWND w, UINT msg, WPARAM wp, LPARAM lp) } if (id == IDOK) { - if (!settingsChanged(w, v)) return 0; + if (!settingsChanged(w, v) && (!v->app->settings.autostart || isLocalBuild())) return 0; if (!confirmSnippetClose(w, &v->snippets)) return 0; if (v->app->busy) throw std::runtime_error("Wait for the current text operation to finish"); diff --git a/src/update.h b/src/update.h index 4c3034b..235a14d 100644 --- a/src/update.h +++ b/src/update.h @@ -2,7 +2,7 @@ #include "platform.h" namespace ks { -inline constexpr wchar_t AppVersion[] = L"0.6.72"; +inline constexpr wchar_t AppVersion[] = L"0.6.73"; inline constexpr UINT UpdateMessage = WM_APP + 7; inline constexpr UINT UpdateCheckIntervalMs = 6 * 60 * 60 * 1000; inline constexpr UINT UpdateNotificationRetryMs = 5 * 60 * 1000;