From 4cd31042016dad28fa9ddf83cb2f82a6f26698f7 Mon Sep 17 00:00:00 2001 From: Anatolii Hrynchuk Date: Fri, 13 Nov 2026 14:24:47 +0200 Subject: [PATCH] Release KSwitcher v0.6.76 with incoming file notifications --- CMakeLists.txt | 2 +- LAN-PREVIEW.md | 6 ++-- Release/README.md | 10 ++++++ Release/SHA256SUMS.txt | 2 +- Release/release-files.json | 68 +++++++++++++++++++------------------- resources/app.rc | 6 ++-- src/app.cpp | 32 ++++++++++++++++-- src/app.h | 2 ++ src/lan.cpp | 6 ++++ src/lan.h | 1 + src/ui_lan.inl | 8 ++++- src/update.h | 2 +- 12 files changed, 99 insertions(+), 46 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b322b6..6a04195 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.24) -project(KSwitcher VERSION 0.6.75 LANGUAGES CXX RC) +project(KSwitcher VERSION 0.6.76 LANGUAGES CXX RC) if(NOT WIN32) message(FATAL_ERROR "KSwitcher uses native Windows APIs") endif() diff --git a/LAN-PREVIEW.md b/LAN-PREVIEW.md index a0722d2..3ffafbe 100644 --- a/LAN-PREVIEW.md +++ b/LAN-PREVIEW.md @@ -12,8 +12,10 @@ with all online paired computers: history and the active clipboard. In **Settings → Computers → Manage computers…**, select an online paired computer and choose **Send file…**. Both computers need a build with file transfer. Files up to 16 MiB travel over encrypted LAN. On the destination, open -**Incoming files…** to save or discard each file. Pending files are held in -memory until saved, discarded, or KSwitcher closes. +**Incoming files…** to save or discard each file. The save dialog suggests the +original filename. KSwitcher shows a Windows notification when a file is ready +to save, and its tray tooltip shows the pending count. Pending files are held +in memory until saved, discarded, or KSwitcher closes. To retrieve the current or rotated diagnostic log, enable **Allow paired computers to download diagnostic logs** on the computer that owns the logs. diff --git a/Release/README.md b/Release/README.md index a29bf3a..b89189b 100644 --- a/Release/README.md +++ b/Release/README.md @@ -1,5 +1,15 @@ # Latest Windows release +## v0.6.76 — 2026-11-13 + +Incoming LAN files suggest their original filename when saved. KSwitcher shows +a Windows tray notification when a file is ready to save, and the tray tooltip +shows the pending count. + +**Українською.** Під час збереження вхідного LAN-файлу пропонується його +оригінальна назва. KSwitcher показує сповіщення в треї, коли файл готовий +до збереження. Підказка іконки показує кількість файлів у черзі. + ## v0.6.75 — 2026-11-13 Conversion cancels earlier when input changes and skips restoring an untouched diff --git a/Release/SHA256SUMS.txt b/Release/SHA256SUMS.txt index 555fb7f..3f16c47 100644 --- a/Release/SHA256SUMS.txt +++ b/Release/SHA256SUMS.txt @@ -1 +1 @@ -36dc789641f72269f4526bf02934788a4dcc48cbe610e4a99bfe0e754ba8977f KSwitcher-win-x64.zip +1f3b641d5b96f289d2d19792876545920f33bd702735d02912abd0218c5c9365 KSwitcher-win-x64.zip diff --git a/Release/release-files.json b/Release/release-files.json index 1de35bb..9ebeb1a 100644 --- a/Release/release-files.json +++ b/Release/release-files.json @@ -1,86 +1,86 @@ { + "schema": 1, "files": [ { - "sha256": "f34c3cc81f01b5c1a2f5008081235c15abbdd204f18a095bebc6fe84d86b135b", + "size": 2249216, "path": "KSwitcher.exe", - "size": 2247680 + "sha256": "a32c5b1b0d86b44d3e4a0b2951f47f04f25a959fdf1f30f0eedd30422a77b0b6" }, { - "sha256": "15df9e958517da640e4b06936bfb724dcdf6c3eec489dfab9ab60c9368b9c425", + "size": 2251776, "path": "KSwitcher.Config.exe", - "size": 2251264 + "sha256": "175939293f867aa38085578dcad6a7a264f801368ec3c63b71faf92c2e5e1731" }, { - "sha256": "db3a8db6bed2484aae9ac5fdee2521e5dcb352c5e7eb1b9b1664886fb2745204", + "size": 3246592, "path": "KSwitcher.Screenshot.exe", - "size": 3246592 + "sha256": "b40a1e4c7553a34d83c5db22303f1815224870dfcf106d679be085c82e807dd3" }, { - "sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c", + "size": 4401, "path": "LICENSE", - "size": 4401 + "sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c" }, { - "sha256": "c0d068392ea65358b798b8c165103560f06e9e3b38c4ab4e2d8810a7b931af86", + "size": 1075, "path": "json-LICENSE.txt", - "size": 1075 + "sha256": "c0d068392ea65358b798b8c165103560f06e9e3b38c4ab4e2d8810a7b931af86" }, { - "sha256": "df6d40d0eb66ad7da8db1cffe6bd211de70dfee474cc228e041c821b3940718b", + "size": 93885, "path": "README.md", - "size": 93885 + "sha256": "df6d40d0eb66ad7da8db1cffe6bd211de70dfee474cc228e041c821b3940718b" }, { - "sha256": "f23bc26ee40daaf8f356d1d4da7f0bf22303a11b80591cf8c8299d9591e2159e", + "size": 11418, "path": "LAN-PREVIEW.md", - "size": 11253 + "sha256": "2c13d3ed4761e679c352fb1ade24a1ec3060ad2862376ede801cdee5fcc3bada" }, { - "sha256": "5f267c141c3d6837870e1c098f86b89a113ba300343119432644ead88f720c21", + "size": 682867, "path": "dictionaries/en.txt", - "size": 682867 + "sha256": "5f267c141c3d6837870e1c098f86b89a113ba300343119432644ead88f720c21" }, { - "sha256": "28a9529c7d0bb4dc51f4bf5c116a3d16ef247a052f7591466768ddf563fd1cf5", + "size": 20138, "path": "dictionaries/LICENSE-CC-BY-SA-4.0.txt", - "size": 20138 + "sha256": "28a9529c7d0bb4dc51f4bf5c116a3d16ef247a052f7591466768ddf563fd1cf5" }, { - "sha256": "2df17fe4e17d527c67ab57269b07dce59a49c1fb128c429a1408decbb47109ec", + "size": 2230, "path": "dictionaries/README.md", - "size": 2230 + "sha256": "2df17fe4e17d527c67ab57269b07dce59a49c1fb128c429a1408decbb47109ec" }, { - "sha256": "9ef922c7699569304a428f6aba0fd13a21341c0d0cb9561f37ef83c41577a28b", + "size": 1060364, "path": "dictionaries/ru.txt", - "size": 1060364 + "sha256": "9ef922c7699569304a428f6aba0fd13a21341c0d0cb9561f37ef83c41577a28b" }, { - "sha256": "d6e11a3aaba22a8a7eaba19f778d8a5bd66653ff306810e85a1b0e7fff3a6b86", + "size": 1279, "path": "dictionaries/sources.json", - "size": 1279 + "sha256": "d6e11a3aaba22a8a7eaba19f778d8a5bd66653ff306810e85a1b0e7fff3a6b86" }, { - "sha256": "caeb097749d4afc84b68ad96b3d7dfb6a6569561cd32ccce0bee94a13b43ba86", + "size": 898248, "path": "dictionaries/uk.txt", - "size": 898248 + "sha256": "caeb097749d4afc84b68ad96b3d7dfb6a6569561cd32ccce0bee94a13b43ba86" }, { - "sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a", + "size": 993, "path": "tools/README.txt", - "size": 993 + "sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a" }, { - "sha256": "6ef5cf64708d62b7fc63c3c793cc99188a513433ff4774cae01dc014f6664376", + "size": 134656, "path": "tools/StayHere.exe", - "size": 134656 + "sha256": "6ef5cf64708d62b7fc63c3c793cc99188a513433ff4774cae01dc014f6664376" }, { - "sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413", + "size": 2796, "path": "tools/StayHere-README.md", - "size": 2796 + "sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413" } ], - "version": "0.6.75", - "schema": 1 + "version": "0.6.76" } diff --git a/resources/app.rc b/resources/app.rc index 8cf0479..77188b7 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,75,0 - PRODUCTVERSION 0,6,75,0 + FILEVERSION 0,6,76,0 + PRODUCTVERSION 0,6,76,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.75" + VALUE "FileVersion", "0.6.76" END END BLOCK "VarFileInfo" diff --git a/src/app.cpp b/src/app.cpp index 4cea75f..9cc3fcb 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -820,11 +820,13 @@ void App::addTray() NOTIFYICONDATAW icon{sizeof(icon)}; icon.hWnd = window; icon.uID = 1; - icon.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; + icon.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP | NIF_SHOWTIP; icon.uCallbackMessage = TrayMessage; icon.hIcon = (HICON)LoadImageW(instance, MAKEINTRESOURCEW(IDI_KSWITCHER), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED); - wcscpy_s(icon.szTip, localBuildTitle(L"KSwitcher — keyboard layouts & clipboard").c_str()); + auto tip = incomingLanFileCount ? L"KSwitcher — files ready to save: " + std::to_wstring(incomingLanFileCount) + : localBuildTitle(L"KSwitcher — keyboard layouts & clipboard"); + wcsncpy_s(icon.szTip, tip.c_str(), _TRUNCATE); if (Shell_NotifyIconW(NIM_ADD, &icon)) { KillTimer(window, TrayRetryTimer); @@ -3019,7 +3021,10 @@ LRESULT CALLBACK App::windowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) return 0; case TrayMessage: if (LOWORD(lp) == NIN_BALLOONUSERCLICK) - showLogs(*app); + { + if (std::exchange(app->incomingFileBalloon, false)) app->dispatch(20); + else showLogs(*app); + } else if (LOWORD(lp) == WM_CONTEXTMENU) app->trayMenu(); else if (LOWORD(lp) == WM_LBUTTONDBLCLK) @@ -3091,9 +3096,30 @@ LRESULT CALLBACK App::windowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) wcsncpy_s(icon.szInfo, text->c_str(), _TRUNCATE); wcscpy_s(icon.szInfoTitle, L"KSwitcher"); icon.dwInfoFlags = NIIF_WARNING; + app->incomingFileBalloon = false; Shell_NotifyIconW(NIM_MODIFY, &icon); return 0; } + case LanFilesChangedMessage: + { + app->incomingLanFileCount = wp; + NOTIFYICONDATAW icon{sizeof(icon)}; + icon.hWnd = hwnd; + icon.uID = 1; + icon.uFlags = NIF_TIP | NIF_SHOWTIP; + auto tip = wp ? L"KSwitcher — files ready to save: " + std::to_wstring(wp) + : localBuildTitle(L"KSwitcher — keyboard layouts & clipboard"); + wcsncpy_s(icon.szTip, tip.c_str(), _TRUNCATE); + if (lp) + { + icon.uFlags |= NIF_INFO; + wcscpy_s(icon.szInfoTitle, L"Incoming file ready to save"); + wcscpy_s(icon.szInfo, L"Open Settings → Computers → Manage computers → Incoming files."); + icon.dwInfoFlags = NIIF_INFO; + } + if (Shell_NotifyIconW(NIM_MODIFY, &icon) && lp) app->incomingFileBalloon = true; + return 0; + } case CheckAutostartMessage: app->checkAutostartPath(); return 0; diff --git a/src/app.h b/src/app.h index 5c2a41f..1cfaa63 100644 --- a/src/app.h +++ b/src/app.h @@ -162,6 +162,8 @@ class App UINT taskbarCreated{}; bool trayRetryPending{}; uint64_t transformAttempt{}, previousAttemptVersion{}; + size_t incomingLanFileCount{}; + bool incomingFileBalloon{}; std::atomic activeTransformAttempt{}; ULONGLONG previousAttemptAt{}; HWND previousAttemptWindow{}; diff --git a/src/lan.cpp b/src/lan.cpp index 32cd3c4..01bb00e 100644 --- a/src/lan.cpp +++ b/src/lan.cpp @@ -161,6 +161,7 @@ struct LanService::Impl {std::lock_guard lock(inputMutex);inputOut.clear();inputIn.clear();inputReady.clear();} std::lock_guard lock(mutex); pending.reset(); peers.clear();clipboard=std::make_unique(id); transfers=std::make_unique(id,"file-transfer");incomingFiles.clear();logDownload.reset(); + if(inputWindow)PostMessageW(inputWindow,LanFilesChangedMessage,0,FALSE); } void send(SOCKET socket,const sockaddr_in &address,const Json &j) { @@ -178,7 +179,10 @@ struct LanService::Impl auto end=std::find(item.bytes.begin(),item.bytes.end(),0); if(end!=item.bytes.begin() && end!=item.bytes.end() && end-item.bytes.begin()<=1024 && item.bytes.end()-end-1<=16*1024*1024) + { incomingFiles.push_back(std::move(item)); + if(inputWindow)PostMessageW(inputWindow,LanFilesChangedMessage,incomingFiles.size(),TRUE); + } } else if(item.app=="log-request" && item.bytes.size()==33) { @@ -448,6 +452,7 @@ struct LanService::Impl atomicWrite(wide(j.at("path").get()),Bytes(start,found->bytes.end())); } incomingFiles.erase(found); + if(inputWindow)PostMessageW(inputWindow,LanFilesChangedMessage,incomingFiles.size(),FALSE); } if(action=="position") { @@ -494,6 +499,7 @@ struct LanService::Impl trusted.erase(peer);positions.erase(peer);if(trusted.empty())shareInput=false; try{save();}catch(...){trusted=std::move(oldTrusted);positions=std::move(oldPositions);shareInput=oldSharing;throw;} std::erase_if(incomingFiles,[&](const auto &file){return file.peer==peer;}); + if(inputWindow)PostMessageW(inputWindow,LanFilesChangedMessage,incomingFiles.size(),FALSE); if(logDownload && logDownload->peer==peer)logDownload.reset(); if(pending&&pending->peer==peer)pending.reset(); configureRouter(); diff --git a/src/lan.h b/src/lan.h index b8ed51f..4a2c7fa 100644 --- a/src/lan.h +++ b/src/lan.h @@ -5,6 +5,7 @@ namespace ks { inline constexpr UINT LanInputReadyMessage=WM_APP+67, LanClipboardReadyMessage=WM_APP+68, LanClipboardPublishMessage=WM_APP+69; +inline constexpr UINT LanFilesChangedMessage=WM_APP+70; struct LanClipboard {std::string peer,name,app;Bytes data;DWORD sequence{};}; // Discovery, pairing and optional encrypted input within the resident process. class LanService diff --git a/src/ui_lan.inl b/src/ui_lan.inl index 5a05a2e..50d1ba1 100644 --- a/src/ui_lan.inl +++ b/src/ui_lan.inl @@ -231,7 +231,13 @@ LRESULT CALLBACK lanProc(HWND w,UINT msg,WPARAM wp,LPARAM lp) auto answer=MessageBoxW(w,question.c_str(),L"Incoming file",MB_YESNOCANCEL|MB_ICONQUESTION); if(answer==IDYES || answer==IDNO) { - auto destination=answer==IDYES?pickLanFile(w,true,L"received-file"):std::filesystem::path{}; + // A peer supplies the display name. Only offer it as a plain Windows filename. + const bool validName = !name.empty() && name.size() <= 255 && + name.find_first_of(L"<>:\"/\\|?*") == name.npos && + name.back() != L'.' && name.back() != L' ' && + std::none_of(name.begin(), name.end(), [](wchar_t c) { return c < L' '; }); + auto destination=answer==IDYES?pickLanFile(w,true,validName?name.c_str():L"received-file"): + std::filesystem::path{}; if(answer==IDNO||!destination.empty()) lanRequest(*v->app,{{"action",answer==IDYES?"saveFile":"discardFile"},{"id",file.at("id")}, {"peer",file.at("peer")},{"path",utf8(destination.wstring())}}); diff --git a/src/update.h b/src/update.h index bda7b54..3ccab2e 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.75"; +inline constexpr wchar_t AppVersion[] = L"0.6.76"; inline constexpr UINT UpdateMessage = WM_APP + 7; inline constexpr UINT UpdateCheckIntervalMs = 6 * 60 * 60 * 1000; inline constexpr UINT UpdateNotificationRetryMs = 5 * 60 * 1000;