Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.
Rust chatgptclaudeclidesktopdesktop-appelectron-alternativegeminilinuxmacosnativefierno-electronrusttauriweb-to-desktopwebsite-to-appwebviewwindowsyoutube
fix: harden Windows icon refresh and npm hotfixes
Tw935946b3eb36fe
diff --git a/.agents/skills/github-ops/SKILL.md b/.agents/skills/github-ops/SKILL.mdindex 26518e39..640fc550 100644--- a/.agents/skills/github-ops/SKILL.md+++ b/.agents/skills/github-ops/SKILL.md@@ -1,7 +1,7 @@---name: github-opsdescription: GitHub issue, PR, and release operations via gh CLI. Not for code review or release builds.-version: 2.0.0+version: 2.1.0allowed-tools:- Bash- Read@@ -29,5 +29,5 @@ Always use `gh` CLI and query live state before acting. Never assume state from2. **NEVER** merge, close, or modify without explicit user request.3. **ALWAYS** query current state before taking action — never assume.4. Before replying to an issue or PR, read the body to confirm the author's language; match their language in the reply. This applies to the author, not to arbitrary thread commenters.-5. Before replying that a fix is released, verify the public artifact first: `npm view pake-cli version` for CLI releases or `gh release view <tag>` for app releases.+5. Before replying that a CLI fix is released, verify the exact artifact with `npm view pake-cli@<version> version gitHead dist.tarball --json` and confirm `gitHead` contains the fix. Check `npm view pake-cli version` separately for the `latest` pointer. For app releases, use `gh release view <tag> --json assets`.6. Before closing an issue after release, confirm the target with `gh issue view <id> --json number,title,state,author,url` and include the concrete version or upgrade command in the comment.diff --git a/.agents/skills/release/SKILL.md b/.agents/skills/release/SKILL.mdindex 44f81ef4..caf168b2 100644--- a/.agents/skills/release/SKILL.md+++ b/.agents/skills/release/SKILL.md@@ -1,7 +1,7 @@---name: releasedescription: Prepare, validate, and publish a Pake release. Not for version bumps without release intent.-version: 1.5.0+version: 1.6.0allowed-tools:- Bash- Read@@ -76,13 +76,14 @@ Do not collapse these into "released" without naming which surface was verified.For CLI or Rust-template fixes that must reach npm fast without an app release. Precedent: 3.15.0 and 3.15.2 shipped this way; the version number is still consumed, so the next `V*` tag skips over it.-1. [ ] Bump all four version files, rebuild `dist/cli.js` (`pnpm run cli:build`), stage with `git add -f dist/cli.js`-2. [ ] Run the pre-release gates that apply: `npx vitest run` and `pnpm run release:check`+1. [ ] Bump all four version files, rebuild `dist/cli.js` with `pnpm run cli:build`, stage the version files, and stage the ignored artifact with `git add -f dist/cli.js`+2. [ ] Run `pnpm run release:check`. For a Rust-template fix, also run the narrow current-platform Rust check before pushing. Do not run `npx vitest run` separately because `release:check` already includes it.3. [ ] Commit `chore: bump version to VX.Y.Z` and push `main`-4. [ ] Dispatch: `gh workflow run npm-publish.yml --ref main`-5. [ ] Poll: `gh run view <run-id> --json status,conclusion`-6. [ ] Verify: `npm view [email protected] version gitHead dist.tarball --json` (gitHead must match the bump commit) and `npm view pake-cli version` for the `latest` pointer-7. [ ] Issue closeout per AGENTS.md; if the fix lives in the Rust template, tell users to rebuild their app after upgrading, because upgrading the CLI alone does not update already-built apps+4. [ ] Record the exact commit selected for publishing with `git rev-parse HEAD`. Find its Quality & Testing run with `gh run list --workflow=quality-and-test.yml --commit <publish-sha> --limit 3 --json databaseId,headSha,status,conclusion`. Wait until that exact SHA is `completed` with `conclusion: success`. For Rust-template changes, confirm the Windows real Tauri build job passed before publishing.+5. [ ] Dispatch with both gates: `gh workflow run npm-publish.yml --ref main -f expected_sha=<publish-sha> -f quality_run_id=<quality-run-id>`. If `main` moved, select the new exact head and wait for its own successful Quality run instead of publishing against stale evidence.+6. [ ] Poll the npm workflow with `gh run view <run-id> --json headSha,status,conclusion`; its `headSha` must match `<publish-sha>`.+7. [ ] Verify `npm view [email protected] version gitHead dist.tarball --json`; `gitHead` must match `<publish-sha>`. Check `npm view pake-cli version` separately for the `latest` pointer.+8. [ ] Issue closeout per AGENTS.md; if the fix lives in the Rust template, tell users to rebuild their app after upgrading, because upgrading the CLI alone does not update already-built appsSkip list, do not do these for a hotfix: no `V*` tag, no GitHub Release or notes, no release reactions, no Docker. App-release surfaces stay untouched until the next `V*` release bundles the fix.@@ -126,7 +127,7 @@ Apply with a notes file to avoid shell escaping: `gh release edit VX.Y.Z --title- npm package settings should use the strict publishing option: require two-factor authentication and disallow tokens. Trusted Publishing still works with this setting.- If local fallback is unavoidable, prefer `npm exec --yes [email protected] -- npm publish --registry=https://registry.npmjs.org` so `prepublishOnly` can find the pinned pnpm version.- Do not reply to GitHub issues or close them as released until `npm view [email protected] version` returns the expected version. `npm view pake-cli version` alone is not enough because `latest` can point at a different commit than the fix under review.-- A `workflow_dispatch` run may execute on `main`; do not treat `headBranch`, run title, or compare UI as the release tag. Check the pushed tag and published package `gitHead`.+- A `workflow_dispatch` run executes on a branch. For npm-only publishing, pass the exact `main` commit as `expected_sha` and a successful Quality run for that SHA as `quality_run_id`; the workflow rejects mismatches. Do not treat `headBranch`, run title, or compare UI as proof of the published source.- If CI creates `chore: update contributors [skip ci]` after the tag is pushed, fast-forward local `main` after the release. Do not retag just to include generated contributor art.## Build Commands (local only)diff --git a/.claude/rules/rust.md b/.claude/rules/rust.mdindex bfb213c5..548de25d 100644--- a/.claude/rules/rust.md+++ b/.claude/rules/rust.md@@ -17,6 +17,10 @@- No `tauriConf: any` or other untyped config bags. Use `PakeTauriConfig`.- Window options live in `bin/helpers/cli-program.ts`, `bin/types.ts`, `bin/defaults.ts`, `bin/helpers/merge.ts`. Adding an option means touching all four plus `schema/pake.schema.json` and `docs/cli-usage*.md`. Forgetting any is a regression; the schema half is caught by `tests/unit/config-file.test.ts`.+### Tauri trust boundary++- Packaged remote pages are untrusted. Validate semantic bounds for every `#[tauri::command]` input, keep remote capabilities limited to the exact operations required, and keep long-running IPC asynchronous so page code cannot block the app loop.+### Platform sensitivity- WebKit compositing on Linux/Wayland is platform-sensitive. Don't change defaults without testing on the affected platform or documenting the risk.diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.ymlindex 9661b4fc..8273b5b4 100644--- a/.github/workflows/npm-publish.yml+++ b/.github/workflows/npm-publish.yml@@ -6,10 +6,21 @@ on:- "V*"# Manual npm-only publish for CLI hotfixes that do not need the full# V* tag release (popular apps, Docker). Version files must already be- # bumped on main; the check step then validates against package.json.+ # bumped on main. Manual publishing is bound to an exact commit and its+ # successful cross-platform Quality & Testing run.workflow_dispatch:+ inputs:+ expected_sha:+ description: Exact main commit to publish+ required: true+ type: string+ quality_run_id:+ description: Successful Quality & Testing run for expected_sha+ required: true+ type: stringpermissions:+ actions: readcontents: readid-token: write@@ -25,13 +36,34 @@ jobs:- name: Checkout repositoryuses: actions/checkout@v6- - name: Check manual publish branch+ - name: Check manual publish source and quality gateif: github.event_name == 'workflow_dispatch'+ env:+ EXPECTED_SHA: ${{ inputs.expected_sha }}+ GH_TOKEN: ${{ github.token }}+ QUALITY_RUN_ID: ${{ inputs.quality_run_id }}run: |if [ "$GITHUB_REF" != "refs/heads/main" ]; thenecho "Manual npm publish must run from main, got ${GITHUB_REF}."exit 1fi+ if [ "$GITHUB_SHA" != "$EXPECTED_SHA" ]; then+ echo "Manual npm publish expected ${EXPECTED_SHA}, but main resolved to ${GITHUB_SHA}."+ exit 1+ fi++ QUALITY_WORKFLOW_ID="$(gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/quality-and-test.yml" --jq '.id')"+ RUN_JSON="$(gh run view "$QUALITY_RUN_ID" --repo "$GITHUB_REPOSITORY" --json event,headBranch,headSha,status,conclusion,workflowDatabaseId)"+ RUN_EVENT="$(jq -r '.event' <<<"$RUN_JSON")"+ RUN_BRANCH="$(jq -r '.headBranch' <<<"$RUN_JSON")"+ RUN_SHA="$(jq -r '.headSha' <<<"$RUN_JSON")"+ RUN_STATUS="$(jq -r '.status' <<<"$RUN_JSON")"+ RUN_CONCLUSION="$(jq -r '.conclusion' <<<"$RUN_JSON")"+ RUN_WORKFLOW_ID="$(jq -r '.workflowDatabaseId' <<<"$RUN_JSON")"+ if [ "$RUN_WORKFLOW_ID" != "$QUALITY_WORKFLOW_ID" ] || [ "$RUN_EVENT" != "push" ] || [ "$RUN_BRANCH" != "main" ] || [ "$RUN_SHA" != "$EXPECTED_SHA" ] || [ "$RUN_STATUS" != "completed" ] || [ "$RUN_CONCLUSION" != "success" ]; then+ echo "Quality run ${QUALITY_RUN_ID} does not prove ${EXPECTED_SHA}: ${RUN_JSON}"+ exit 1+ fi- name: Install pnpmuses: pnpm/action-setup@v4diff --git a/AGENTS.md b/AGENTS.mdindex e49d80bb..0d5357e6 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -87,7 +87,7 @@ Goals and project facts only; trust the agent to find its own path.- Release state can be split. npm Trusted Publishing can succeed before the popular-app release workflow finishes, and GitHub Release assets can exist while a workflow run still shows queued or in progress. Report each surface explicitly.- Local app builds and test runs mutate tracked files as build state: `src-tauri/pake.json`, `src-tauri/tauri.conf.json`, `src-tauri/tauri.macos.conf.json`, and regenerated icons under `src-tauri/png/` and `src-tauri/icons/`. Before committing, `git restore` whatever you did not intentionally change; never let a feature or release commit absorb this churn.- Per-app optional fields in `default_app_list.json` consumed by workflows must get their defaults in the jq read step of `release.yml`, not in Actions expressions: GitHub expressions cast both `null` and `false` to `0`, so `matrix.config.x != false` cannot express "default true" and silently flips every app missing the field.-- Windows taskbar icons can register blank when an autostarted app launches before Explorer's icon cache is ready (#1323). Every hidden-to-visible path for the main window (tray show/click, activation shortcut, single-instance activation, initial delayed show) must call `reapply_window_icon` from `src-tauri/src/app/window.rs`; adding a new `window.show()` path without it regresses the bug.+- Windows taskbar icons can register blank when an autostarted app launches before Explorer's icon cache is ready (#1323). Every hidden-to-visible path for the main window (tray show/click, activation shortcut, single-instance activation, initial delayed show) must call `reapply_window_icon` from `src-tauri/src/app/window.rs`, which reasserts both the small window icon and the large taskbar icon; adding a new `window.show()` path without it regresses the bug.- `.github/workflows/pake-cli.yaml` and `single-app.yaml` are public build surfaces that external users trigger from their own forks (see `docs/github-actions-usage*.md`). Changes there ship to outside users on push to `main`, independent of `V*` releases; treat them like public API, not internal CI.## Platform-Specific Development@@ -146,13 +146,13 @@ The workflow can also be triggered manually via `workflow_dispatch` with optionsPushing the same `V*` tag also triggers `.github/workflows/npm-publish.yml`, which publishes `pake-cli` to npm through Trusted Publishing. Configure the npm package's Trusted Publisher as GitHub Actions, `tw93/Pake`, workflow file `npm-publish.yml`, with no environment. Local `npm publish` is only a fallback when CI or npm registry state blocks the trusted path.-`npm-publish.yml` also supports `workflow_dispatch` from `main` for npm-only CLI hotfixes: bump the version files on `main`, then trigger the workflow to publish to npm without a `V*` tag or app release. npm publish and `git tag` are therefore independent actions; never infer one from the other. At the start of any release task, restate which surfaces this round touches (npm package, GitHub Release + app assets, Docker, git tag) and let the maintainer confirm. Each publish, tag, or issue-close action needs maintainer authorization in the current turn.+`npm-publish.yml` also supports `workflow_dispatch` from `main` for npm-only CLI hotfixes: bump the version files on `main`, wait for a successful `quality-and-test.yml` run for the exact commit, then pass that commit as `expected_sha` and the successful run as `quality_run_id`. The publish workflow verifies both before publishing without a `V*` tag or app release. npm publish and `git tag` are therefore independent actions; never infer one from the other. At the start of any release task, restate which surfaces this round touches (npm package, GitHub Release + app assets, Docker, git tag) and let the maintainer confirm. Each publish, tag, or issue-close action needs maintainer authorization in the current turn.Before treating an npm release as shipped, verify both `gh workflow list --all | grep "Publish npm Package"` and `npm view [email protected] version`. Prefer `npm view [email protected] version gitHead dist.tarball --json` so the published package can be tied back to the intended commit. Do not reply to or close GitHub issues as released until the public registry returns the expected version.For release follow-through, keep these boundaries explicit:-- `workflow_dispatch` runs on a branch unless a tag ref or input is supplied. Do not infer a release tag from the branch name, run title, or compare UI.+- `workflow_dispatch` runs on a branch. Bind npm-only publishing to the exact `main` commit with `expected_sha` and a successful Quality run for that same SHA; do not infer a release tag or source commit from the branch name, run title, or compare UI.- For CLI/npm issue closeout, the npm registry is the decisive public surface. GitHub app release assets and quality workflows should still be reported, but they are separate surfaces.- For app-release claims, inspect the GitHub Release directly with `gh release view <tag> --json assets` and check asset count/state instead of trusting source state or workflow names alone.- The contributors bot can push `chore: update contributors [skip ci]` at any moment, including between local commits and the bump push. On a rejected push, `git pull --rebase` onto it and push again before tagging. After release, fast-forward local `main`; do not move an already pushed release tag to include it.diff --git a/README.md b/README.mdindex 5019fa51..a0ba414b 100644--- a/README.md+++ b/README.md@@ -197,7 +197,7 @@ Using Pake from a script or AI agent? Pass `--json` for machine-readable resultsCopy this to your AI agent to get started:```text-Use Pake (npm i -g pake-cli) to package webpages as desktop apps. Read https://raw.githubusercontent.com/tw93/Pake/main/llms.txt first; always run pake with --json and parse stdout as a single JSON object. Package <url-or-local-dist> into an app named <AppName>.+Use Pake (npm i -g pake-cli) to package webpages as desktop apps. Read https://unpkg.com/pake-cli@latest/llms.txt first; always run pake with --json and parse stdout as a single JSON object. Package <url-or-local-dist> into an app named <AppName>.```## Developmentdiff --git a/README_CN.md b/README_CN.mdindex 3fd9a110..32c1671e 100644--- a/README_CN.md+++ b/README_CN.md@@ -198,7 +198,7 @@ pake https://weekly.tw93.fun --name Weekly --icon https://cdn.tw93.fun/pake/week把下面这段复制给你的 AI agent 即可开始:```text-用 Pake(npm i -g pake-cli)把网页打包成桌面应用。先阅读 https://raw.githubusercontent.com/tw93/Pake/main/llms.txt,运行 pake 时始终加 --json 并把 stdout 解析为单个 JSON 对象。把 <url-or-local-dist> 打包成名为 <AppName> 的应用。+用 Pake(npm i -g pake-cli)把网页打包成桌面应用。先阅读 https://unpkg.com/pake-cli@latest/llms.txt,运行 pake 时始终加 --json 并把 stdout 解析为单个 JSON 对象。把 <url-or-local-dist> 打包成名为 <AppName> 的应用。```## 定制开发diff --git a/package.json b/package.jsonindex 4f792ec7..d2b8c2cf 100644--- a/package.json+++ b/package.json@@ -27,6 +27,7 @@],"files": ["LICENSE-EXCEPTION",+ "llms.txt","dist","src-tauri"],diff --git a/scripts/check-release-version.mjs b/scripts/check-release-version.mjsindex 5dcda6e0..329e9f3d 100644--- a/scripts/check-release-version.mjs+++ b/scripts/check-release-version.mjs@@ -91,6 +91,12 @@ if (!packageJson.files?.includes("LICENSE-EXCEPTION")) {);}+if (!packageJson.files?.includes("llms.txt")) {+ errors.push(+ "package.json files: llms.txt must be included in the npm package",+ );+}+if (errors.length > 0) {console.error("Release version check failed:");for (const error of errors) {diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lockindex 72aec1b1..a8e93efa 100644--- a/src-tauri/Cargo.lock+++ b/src-tauri/Cargo.lock@@ -2582,6 +2582,7 @@ dependencies = ["tauri-plugin-single-instance","tauri-plugin-window-state","tokio",+ "windows-sys 0.61.2",][[package]]diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.tomlindex 1feeca31..56d63387 100644--- a/src-tauri/Cargo.toml+++ b/src-tauri/Cargo.toml@@ -41,6 +41,13 @@ objc2 = "0.6"objc2-app-kit = { version = "0.3", features = ["NSApplication", "NSDockTile"] }objc2-foundation = { version = "0.3", features = ["NSString"] }+[target.'cfg(windows)'.dependencies]+windows-sys = { version = "0.61.2", features = [+ "Win32_Foundation",+ "Win32_UI_Shell",+ "Win32_UI_WindowsAndMessaging",+] }+[features]# this feature is used for development builds from development clicli-build = []diff --git a/src-tauri/src/app/window.rs b/src-tauri/src/app/window.rsindex 6e8a2c77..ff78e512 100644--- a/src-tauri/src/app/window.rs+++ b/src-tauri/src/app/window.rs@@ -3,6 +3,8 @@ use crate::util::{check_file_or_append, get_data_dir, get_download_message_with_lang, sanitize_download_filename,show_toast, MessageType,};+#[cfg(target_os = "windows")]+use std::{os::windows::ffi::OsStrExt, ptr, sync::OnceLock};use std::{path::PathBuf,str::FromStr,@@ -13,6 +15,12 @@ use tauri::{AppHandle, Config, Manager, Url, WebviewUrl, WebviewWindow, WebviewWindowBuilder,};+#[cfg(target_os = "windows")]+use windows_sys::Win32::UI::{+ Shell::ExtractIconExW,+ WindowsAndMessaging::{SendMessageW, ICON_BIG, WM_SETICON},+};+use tauri::Theme;#[cfg(target_os = "macos")]@@ -69,14 +77,70 @@ pub fn open_additional_window(app: &AppHandle) -> tauri::Result<WebviewWindow> {build_window_with_label(app, &state.pake_config, &state.tauri_config, &label)}-// Apps autostarted at Windows logon can register their window icon before-// Explorer's icon cache is ready, leaving a blank taskbar icon until the icon-// is asserted again (#1323), so re-apply it whenever a window becomes visible.+#[cfg(target_os = "windows")]+fn taskbar_icon_handle() -> Option<isize> {+ static TASKBAR_ICON: OnceLock<Option<isize>> = OnceLock::new();++ *TASKBAR_ICON.get_or_init(|| {+ let executable = match std::env::current_exe() {+ Ok(path) => path,+ Err(error) => {+ eprintln!(+ "[Pake] Failed to resolve the app executable for its taskbar icon: {error}"+ );+ return None;+ }+ };+ let executable_wide: Vec<u16> = executable+ .as_os_str()+ .encode_wide()+ .chain(std::iter::once(0))+ .collect();+ let mut large_icon = ptr::null_mut();+ let extracted = unsafe {+ ExtractIconExW(+ executable_wide.as_ptr(),+ 0,+ &mut large_icon,+ ptr::null_mut(),+ 1,+ )+ };+ if extracted == 0 || large_icon.is_null() {+ eprintln!(+ "[Pake] Failed to extract the taskbar icon from {}.",+ executable.display()+ );+ return None;+ }++ // WM_SETICON keeps this handle rather than copying it. Cache the single+ // extracted icon for the process lifetime so repeated tray restores do+ // not leak a new HICON or leave the window with a dangling handle.+ Some(large_icon as isize)+ })+}++// Apps autostarted at Windows logon can register their icons before Explorer's+// icon cache is ready (#1323). Re-assert both the small/title-bar icon and the+// large taskbar icon whenever a window becomes visible.#[cfg(target_os = "windows")]pub fn reapply_window_icon(window: &WebviewWindow) {if let Some(icon) = window.app_handle().default_window_icon().cloned() {if let Err(error) = window.set_icon(icon) {- eprintln!("[Pake] Failed to re-apply window icon: {error}");+ eprintln!("[Pake] Failed to re-apply the window icon: {error}");+ }+ }++ let Some(taskbar_icon) = taskbar_icon_handle() else {+ return;+ };+ match window.hwnd() {+ Ok(hwnd) => unsafe {+ SendMessageW(hwnd.0, WM_SETICON, ICON_BIG as usize, taskbar_icon);+ },+ Err(error) => {+ eprintln!("[Pake] Failed to resolve the window handle for its taskbar icon: {error}");}}}@@ -114,6 +178,7 @@ fn open_requested_window(let title = target_url.host_str().unwrap_or(target_url.as_str());let _ = window.set_title(title);+ reapply_window_icon(&window);let _ = window.set_focus();Ok(window)@@ -126,6 +191,7 @@ pub fn open_additional_window_safe(app: &AppHandle) {std::thread::spawn(move || {if let Ok(window) = open_additional_window(&app_handle) {let _ = window.show();+ reapply_window_icon(&window);let _ = window.set_focus();}});@@ -135,6 +201,7 @@ pub fn open_additional_window_safe(app: &AppHandle) {{if let Ok(window) = open_additional_window(app) {let _ = window.show();+ reapply_window_icon(&window);let _ = window.set_focus();}}diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rsindex 47547dfb..76435c7b 100644--- a/src-tauri/src/lib.rs+++ b/src-tauri/src/lib.rs@@ -302,6 +302,7 @@ pub fn run_app() {if !has_visible_windows {if let Some(window) = _app.get_webview_window("pake") {let _ = window.show();+ reapply_window_icon(&window);let _ = window.set_focus();}}diff --git a/src-tauri/src/util.rs b/src-tauri/src/util.rsindex c5fd7f1f..b3c36ee2 100644--- a/src-tauri/src/util.rs+++ b/src-tauri/src/util.rs@@ -183,16 +183,21 @@ mod tests {use std::env;use std::fs;use std::path::PathBuf;+ use std::sync::atomic::{AtomicU64, Ordering};++ static TEMP_PATH_COUNTER: AtomicU64 = AtomicU64::new(0);fn temp_path(name: &str) -> PathBuf {let mut dir = env::temp_dir();+ let unique = TEMP_PATH_COUNTER.fetch_add(1, Ordering::Relaxed);dir.push(format!(- "pake-util-test-{}-{}",+ "pake-util-test-{}-{}-{}",std::process::id(),std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_nanos())- .unwrap_or(0)+ .unwrap_or(0),+ unique));fs::create_dir_all(&dir).unwrap();dir.push(name);diff --git a/tests/unit/window-icon-reapply.test.ts b/tests/unit/window-icon-reapply.test.tsnew file mode 100644index 00000000..f4719b22--- /dev/null+++ b/tests/unit/window-icon-reapply.test.ts@@ -0,0 +1,35 @@+import fs from 'node:fs';+import path from 'node:path';+import { describe, expect, it } from 'vitest';++const rustRoot = path.join(process.cwd(), 'src-tauri', 'src');+const windowSource = fs.readFileSync(+ path.join(rustRoot, 'app', 'window.rs'),+ 'utf8',+);+const visibilitySources = [+ path.join(rustRoot, 'lib.rs'),+ path.join(rustRoot, 'app', 'setup.rs'),+ path.join(rustRoot, 'app', 'window.rs'),+].map((source) => fs.readFileSync(source, 'utf8'));++describe('Windows taskbar icon reapplication', () => {+ it('targets the large taskbar icon instead of only the small window icon', () => {+ expect(windowSource).toContain('ExtractIconExW');+ expect(windowSource).toContain('WM_SETICON');+ expect(windowSource).toContain('ICON_BIG');+ });++ it('reapplies the icon after every explicit window show', () => {+ for (const source of visibilitySources) {+ const shows = [...source.matchAll(/let _ = (\w+)\.show\(\);/g)];+ for (const show of shows) {+ const followingSource = source.slice(+ (show.index ?? 0) + show[0].length,+ (show.index ?? 0) + show[0].length + 160,+ );+ expect(followingSource).toContain(`reapply_window_icon(&${show[1]});`);+ }+ }+ });+});