DEV Community

Evan Lin for Google Developer Experts

Posted on Originally published at evanlin.com on

[Kalamos Dev] From macOS to Windows: Deconstructing W1–W6, Reviewing PR #79, and 5 Real Windows CI Pitfalls

Kalamos Cross-platform Architecture and Dual-platform CI / Release Pipeline: Shared Core Layer, macOS and Windows Specific Boundaries, and GitHub Actions CI and Release Matrix

Recap

In the previous record of Kalamos's beginning, we spent three days turning this Typora-style, WYSIWYG Markdown desktop editor into an MIT open-source project at v0.1.1—at that time, the goal was simple: macOS only.

Unexpectedly, just a few days after going open source, the community sent a huge gift: external contributor @mingchuanhuang-xpc submitted PR #79, which single-handedly implemented the core engineering for the Windows port (drive paths, headless Edge PDF export, single instance, PATHEXT search, windows-latest CI).

This series of articles is divided into three parts to document the evolution during this period: The previous post (2026-11-23) discussed feature advancement, review processes, and handling external PRs after going open source, as well as release automation with Biome and Changesets; this post focuses specifically on "what to actually watch out for when porting a Tauri 2 desktop app, originally running only on macOS, to Windows 10/11 (x64)"; as for the final piece of the puzzle—in-app auto-updates (W5)—that will be left for the next post (2026-11-25).

Links to the project and the first version with a Windows installer are provided below:


I. Planning: Breaking Windows Support into W1–W6, Starting with a Non-conflicting Release Pipeline

After receiving external PR #79, we didn't rush to merge it and claim "Windows support."

At that time, the main branch was also advancing two major changes: #78 (Native menus and preference window) and #81 (Multi-document tabs), neither of which were accounted for in #79. More importantly, from v0.1.1 to v0.3.0, we were still manually packaging macOS .dmg files, without even a release pipeline capable of automatically producing Windows installers.

Instead of jamming "App porting, UX adjustments, packaging, documentation updates, auto-updates, and single-file exe" into one giant PR and getting stuck, we opened a master Epic (#86), breaking the entire Windows support into six clearly bounded stages, W1–W6:

Stage Issue / PR Scope and Dependencies Current Status
W1 #87 → PR #93 Release automation: release.yml, macOS dual-arch .dmg + Windows NSIS / MSI, SHA256SUMS.txt, Draft Release Completed
W2 #88 → PR #94 Windows App porting core: Based on @mingchuanhuang-xpc's PR #79, integrating #78 and #81 Completed
W3 #89 → PR #97 Windows UX: In-window menu bar, shortcut text, title bar and tab bar, Alt+F4 exit check, fonts (Depends on W2) Completed
W4 #90 → PR #96 Four-language README and product page with Windows installation instructions and platform-specific download buttons (Depends on W1, W2) Completed
W5 #91 In-app auto-update tauri-plugin-updater (Depends on W1, scheduled last, see next post) Completed
W6 #95 Windows portable single-file exe (windows-gnu embedding WebView2Loader.dll, P2, split from #79) Open for tracking

There were two critical arrangements in this sequence:

  1. Do W1 first, then take over #79 (W2): The packaging settings for release.yml and tauri.conf.json do not conflict with the App code in #79 at all. By merging W1 first and using workflow_dispatch to confirm the CI can actually produce macOS .dmg and Windows NSIS / MSI, we had real installers to download after completing each subsequent stage, without fighting with #79.
  2. Finish W4 but don't merge until v0.4.0 is released: PR #96 was ready early, but we deliberately held off on merging until the first v0.4.0 with a real Windows installer was public, avoiding a situation where the Windows download button on the product page linked to a release without Windows assets.

We also explicitly stated in Epic #86 what was out of scope for this round: Windows code signing (e.g., Azure Trusted Signing), Apple notarization, Linux / ARM64 Windows, Microsoft Store / winget. Defining boundaries early prevents scope creep.


II. Reviewing External PR #79: Read build.rs Before Building, and Four Key Issues Identified

Conclusion first: @mingchuanhuang-xpc's PR #79 was a very sincere and high-quality porting effort (35 files, +1358 / −167). It didn't just handle C:/ and file:///C:/ paths, dunce::canonicalize to remove Windows \\?\ prefixes, headless Edge / Chrome PDF export, tauri-plugin-single-instance with File Explorer integration, PATHEXT searching, and CREATE_NO_WINDOW to prevent black window flashes; it also fixed a real UI bug—the "Papyros" option in the dark theme menu and the "Melan" option in the light menu were nearly invisible because the buttons had the wrong text color due to the data-theme attribute.

Security Review Discipline: Read build.rs first, build locally only after confirming safety

When reviewing a Rust / Tauri PR from an external fork, there is a hard security line: Never execute cargo test or npm run build locally before reading through build.rs.

Because Rust's build.rs executes arbitrary code with local permissions during the compilation phase. We checked three things in an independent read-only worktree before allowing local testing:

  1. Read src-tauri/build.rs line by line: Confirmed it only acts when target_os = "windows" && target_env = "gnu", and its content only outputs linker parameters and copies WebView2Loader.dll—no network access, no Command execution, no download behavior, and no reading of environment secrets.
  2. Confirm no bundled binaries: Used git diff --numstat to ensure no binary items were included. WebView2Loader.dll comes from webview2-com-sys on crates.io (which includes the official Microsoft NuGet package) and tauri-build, with Cargo.lock checksums locked.
  3. Verify new dependencies and CI workflow: The added dunce 1.0.5 and tauri-plugin-single-instance 2.5.5 are well-known or official crates; CI changes did not use pull_request_target, didn't touch secrets, and didn't introduce new third-party actions.

Once the security check passed, we ran the full suite of vitest, cargo test, clippy, build, and Playwright on local macOS to ensure no functional regression.

Four Issues Found During Code Review

Next, we reviewed item by item against the main branch and security model, identifying four issues that needed addressing:

  1. windows-gnu single-file exe build.rs directory depth error (Blocker): To produce a portable single-file exe, the PR hardcoded ancestors().nth(4) in src-tauri/build.rs to find WebView2Loader.dll from OUT_DIR. However, in the stable Cargo directory structure target/<profile>/build/<pkg>-<hash>/out, ancestors().nth(4) points to target/ (or target/<triple>/), not target/<profile>/ (it only matches in the nightly new structure). Failing to find the file causes compilation to fail; worse, if an old file remains, it might silently embed an outdated DLL. Additionally, GitHub Actions' windows-latest defaults to MSVC, so this windows-gnu branch was never compiled by CI, and although the comment mentioned --allow-multiple-definition, it wasn't actually added to the code. → Solution: Split the GNU single-file exe logic in webview2_embed.rs and build.rs into a separate Issue W6 (#95). In the future, we will use find(|p| p.file_name() == "build").parent() like tauri-build to find the directory and add an x86_64-pc-windows-gnu CI job.

  2. DLL landing only compared file size (Should-fix): webview2_embed.rs extracted the embedded WebView2Loader.dll to %LOCALAPPDATA%\io.kalamos.app\. Before writing, it only compared the file size on disk to decide whether to overwrite, and would fall back to temp_dir() if LOCALAPPDATA wasn't found. This means that under the same user permissions, if another program replaced it with a malicious DLL of the same size, Kalamos would load it via LoadLibraryW every time it started, becoming a persistence point. Although the threat model is low and it only compiles in the GNU branch, the fix is simple: change to comparing SHA-256 (or overwrite every time), use a temporary file with an atomic rename, and return an error instead of falling back to temp_dir() if LOCALAPPDATA is missing—these specs were included in #95.

  3. README mentioned Windows downloads that didn't exist yet (Should-fix): The README in the PR said "Download the latest Windows installer from Releases," but there were no Windows release assets at the time. It also stated "Windows 10 / 11 has built-in WebView2," whereas only Windows 11 guarantees it; some Windows 10 environments (like LTSC or long-unupdated systems) might not have it. The English build requirements also missed Windows conditions and were out of sync with the Chinese version.

  4. Floating buttons appeared in the top-left on macOS (Should-fix): The PR placed "Toggle Sidebar" and "Open File" floating buttons in the top-left corner, but they showed up on all platforms. After #78 was merged, macOS already had a full native top menu, so this changed the macOS UI without a product decision. We decided to show them only when IS_WINDOWS is true, while also clarifying the new behaviors for dragging and dropping .md files to open and .docx files to import, adding Playwright tests for them.

Since the main branch had already merged #78 and #81, we left detailed review comments on PR #79 and opened PR #94 (W2) to take over: the first commit cherry-picked @mingchuanhuang-xpc's original commit (preserving the original author field) and resolved conflicts with #78 and #81; the second commit focused on applying all the review fixes mentioned above (adding a Co-authored-by signature when finally squash-merging into main). Then we pushed it to GitHub Actions—and that's where the real fun began.


III. Five Pitfalls Encountered in Windows CI

After running 480+ unit tests, 100+ Rust tests, and 180+ Playwright E2E tests on local macOS with all green lights, we hit five very solid cross-platform landmines as soon as we entered the GitHub Actions windows-latest runner. Each of these pitfalls had a clear root cause and was almost impossible to anticipate just by working on macOS.

Pitfall 1: Path::new("/").is_absolute() is false on Windows

While reviewing #79, we added a !path.is_absolute() check to check_asset_dir in src-tauri/src/images.rs to prevent relative paths from being allowed based on the process cwd. Unit tests passed on macOS but failed on windows-latest.

Reason: The test used check_asset_dir(Path::new("/"), Some(&home)), expecting a TOO_BROAD_MESSAGE ("Image root directory range is too broad"). On Windows, "/" without a drive letter is a drive-relative path (relative to the current drive's root, e.g., relative to C: or D:), not a full absolute path. Therefore, the Rust standard library's Path::new("/").is_absolute() returns false! The test was blocked at the first "must be an absolute path" check and never reached is_too_broad.

Fix: Don't hardcode "/". Instead, derive the actual OS root directory from the home path used in the test (Unix gets /, Windows gets C:\), so both sides test the same thing:

// The filesystem root (`/` on Unix, `C:\` on Windows) is always too broad.
let fs_root = home.ancestors().last().expect("filesystem root");
let err = check_asset_dir(fs_root, Some(&home)).unwrap_err();
assert!(err.message.starts_with(TOO_BROAD_MESSAGE));
Enter fullscreen mode Exit fullscreen mode

Pitfall 2: Headless Edge fails to output PDF with --blink-settings=scriptEnabled=false

This pitfall was particularly ironic—it was triggered by a change we requested ourselves during the review.

Reason: The macOS PDF export explicitly sets setAllowsContentJavaScript(false) in WKWebView. During the review of #79, we wanted the Windows headless Edge to follow suit, so we requested removing --allow-file-access-from-files and adding --blink-settings=scriptEnabled=false. Consequently, when running real headless Edge export tests on windows-latest, Edge exited normally with code 0 but wrote no PDF file at all! It turns out this Blink flag breaks the Chromium / Edge --print-to-pdf pipeline.

Fix: Remove --blink-settings=scriptEnabled=false. Instead, in the already isolated --user-data-dir temporary profile, pre-write Chromium's Content Settings (Default/Preferences), setting javascript to 2 (blocked). This, combined with the strict CSP (default-src 'none') already in src/export/html.ts, forms a double layer of protection. We also included the browser's exit code and the end of stderr in the error message to avoid guessing in the future:

pub(super) fn prepare_no_js_profile(profile: &Path) -> Result<(), AppError> {
    let default_dir = profile.join("Default");
    fs::create_dir_all(&default_dir)?;
    fs::write(
        default_dir.join("Preferences"),
        r#"{"profile":{"default_content_setting_values":{"javascript":2}}}"#,
    )?;
    Ok(())
}
Enter fullscreen mode Exit fullscreen mode

Pitfall 3: CodeMirror single-letter shortcuts ignore Shift; Ctrl+O hijacks Ctrl+Shift+O

After passing Rust tests, the Playwright E2E on windows-latest reported an error: the test pressed Ctrl+Shift+O (Open Folder), but Ctrl+O (Open File) was triggered instead!

Reason: Digging into the CodeMirror 6 keymap implementation revealed the truth. When handling single-character keys, CodeMirror intentionally ignores the Shift- modifier (internal logic is modifiers(name, event, !isChar)), because pressing Shift + o on a standard keyboard sends an uppercase event.key === "O", and character casing is enough to distinguish them. However, in two scenarios—the user has Caps Lock on, or synthetic keyboard events on Windows (like Playwright sending Control+Shift+o)—the browser sends a lowercase key: "o" but with shiftKey: true. In these cases, the Mod-o binding without Shift is matched because Shift- is ignored, and it consumes the event before Mod-Shift-O or an outer window listener can; the same happens with s, f, e, g, and other single-letter shortcuts.

Fix: Add a highest priority (Prec.highest) keydown handler in src/editor/keymaps.ts to record the event.shiftKey of the current event in a WeakMap<EditorView, boolean> before the CodeMirror keymap runs. Then, write a small wrapper function unshifted(cmd) to apply to all single-letter bindings that shouldn't consume Shift (Mod-o, Mod-s, Mod-n, Mod-b, Mod-i, Mod-k, Mod-f, Mod-g, etc.), and remove their original unconditional preventDefault: true (CodeMirror already calls preventDefault when a command returns true):

const lastKeydownShift = new WeakMap<EditorView, boolean>();

export const trackKeydownExtension = Prec.highest(
  EditorView.domEventHandlers({
    keydown(event, view) {
      lastKeydownShift.set(view, event.shiftKey);
      return false;
    },
  }),
);

export function unshifted(cmd: Command): Command {
  return (view) => {
    if (lastKeydownShift.get(view)) return false;
    return cmd(view);
  };
}
Enter fullscreen mode Exit fullscreen mode

Finally, after adding regression E2E tests simulating the Win32 platform, Ctrl+Shift+O correctly opens the folder without being intercepted by Ctrl+O.

Pitfall 4: Changing UA isn't enough for Playwright E2E; navigator.platform is still Win32 on Windows runners

Moving to W3 (PR #97), we wrote a batch of Playwright E2E tests for the dual-platform interface, verifying both "Simulated macOS" and "Simulated Windows" scenarios in the same test file. All green on local macOS, but it failed again on windows-latest.

Reason: Looking at how src/platform.ts detects the platform explains it:

if (/Windows NT|Win64|WOW64/i.test(ua) || /^Win/i.test(plat))
  return "windows";
Enter fullscreen mode Exit fullscreen mode

The original test only called browser.newContext({ userAgent: macUA }). On local macOS, navigator.platform is already "MacIntel", so the flaw was hidden. But on a Windows runner, the "Simulated macOS" BrowserContext changed the User-Agent, but the underlying navigator.platform was still "Win32", so detectPlatform() still identified it as Windows!

Fix: Extract a shared newPlatformContext(browser, "macos" | "windows") in tests/e2e/helpers.ts. In addition to setting the userAgent, use ctx.addInitScript to overwrite both navigator.platform ("MacIntel" / "Win32") and navigator.userAgentData ("macOS" / "Windows"):

export async function newPlatformContext(
  browser: Browser,
  target: keyof typeof PLATFORM_PROFILES,
): Promise<BrowserContext> {
  const profile = PLATFORM_PROFILES[target];
  const ctx = await browser.newContext({ userAgent: profile.userAgent });
  await ctx.addInitScript(({ platform, uaDataPlatform }) => {
    Object.defineProperty(navigator, "platform", {
      configurable: true,
      get: () => platform,
    });
    Object.defineProperty(navigator, "userAgentData", {
      configurable: true,
      get: () => ({
        brands: [],
        mobile: false,
        platform: uaDataPlatform,
        getHighEntropyValues: async () => ({ platform: uaDataPlatform }),
      }),
    });
  }, profile);
  return ctx;
}
Enter fullscreen mode Exit fullscreen mode

From then on, platform simulation behavior remained consistent regardless of whether the test ran on a macOS or Windows runner.

Pitfall 5: Biome flags every file as formatted incorrectly on Windows due to core.autocrlf

The final pitfall appeared when introducing Biome to the CI (PR #101, taking over the second part of external contributor @narumiruna's #85). We added npx biome ci to ci.yml. Zero errors on macOS, but on windows-latest, almost every file in the repo was flagged by Biome as a formatting error!

Reason: The windows-latest runner on GitHub Actions has Git's core.autocrlf enabled by default. When actions/checkout pulls the repo, it automatically converts all text file LF line endings to CRLF. Biome's line-ending style check immediately failed across the board. After checking the entire repo, no files actually needed to be stored with CRLF (tests verifying CRLF retention behavior all constructed strings in memory).

Fix: Add a .gitattributes file to the repo root, using * text=auto eol=lf to force all text files to LF. Simultaneously, explicitly mark images, icons, PDFs, and font files as binary to prevent Git from touching binary assets:

* text=auto eol=lf

# Binary assets (images, icons, fonts)
*.png binary
*.jpg binary
*.ico binary
*.icns binary
*.pdf binary
*.woff2 binary
*.ttf binary
Enter fullscreen mode Exit fullscreen mode

Summarizing these five Windows CI pitfalls into a quick reference table:

# Symptom Root Cause Fix PR
1 check_asset_dir test error isn't "too broad" Path::new("/").is_absolute() is false on Windows (drive-relative) Use home.ancestors().last() to get the actual OS root #94
2 Headless Edge exit 0 but no PDF --blink-settings=scriptEnabled=false breaks --print-to-pdf Write to isolated profile Default/Preferences to disable JS, plus CSP #94
3 Ctrl+Shift+O triggers Ctrl+O CodeMirror single-letter keys ignore Shift; hijacked by Caps Lock or synthetic events Use Prec.highest to record shiftKey + unshifted() wrapper #94
4 Simulated macOS E2E fails on Windows runner UA change isn't enough; navigator.platform is still Win32 Use newPlatformContext to overwrite UA, platform, and userAgentData #97
5 biome ci fails for all files on Windows windows-latest core.autocrlf converts LF to CRLF Add .gitattributes with * text=auto eol=lf to lock LF #101

IV. Windows UX Details: "Compilable" Doesn't Mean "Windows Supported" (W3)

After the core functionality turned green in Windows CI, we moved to W3 (#89 / PR #97). If we simply moved the macOS interface to Windows, users would be confused: "Services" and "Hide Others" appearing in the menu, hints showing ⌘S and ⌥⇧⌘←, and Alt+F4 closing unsaved drafts without asking.

We broke Windows UX into four specific items to complete:

1. Native Menus Generated per Platform, Sharing One Spec File

Kalamos's menu definitions are centralized in src/menu/menu-spec.json, shared by Rust (src-tauri/src/menu.rs) and the frontend. W3 added an optional "platforms" field (["macos"] or ["windows", "linux"]) to each menu node:

  • macOS: Maintains the original system top App menu bar (including "About", "Preferences", "Services", "Hide", "Hide Others", "Show All", "Quit").
  • Windows: Presented as an in-window native menu bar, automatically filtering out macOS-specific items; following Windows user habits, "Preferences (Ctrl+,)" and "Exit (Ctrl+Q)" were moved to the File menu, and "About" (and later "Check for Updates..." in W5) was moved to the Help menu.
  • For shortcuts originally triggered only by menu accelerators on macOS, the frontend added fallback keydown listeners and used the shared spec to deduplicate, preventing double triggers and ensuring all shortcuts are accessible on Windows.

2. Shortcut Text Changed to Ctrl / Alt / Shift, Paths Converted Back to Backslashes

All hint text in the frontend (Preferences, Find bar tooltips, tabs, sidebar, theme menu, table toolbar) was originally written with macOS symbols or terms (⌘, ⌥, ⇧, Cmd+Opt+T). We unified this via shortcutLabel() in src/platform.ts, which automatically rewrites them to Ctrl+Alt+Shift+... (e.g., ⌥⇧⌘← → Ctrl+Alt+Shift+←) when Windows / Linux is detected. The underlying CodeMirror Mod- bindings already map to Ctrl automatically.

For paths, we adopted a "Unified Internally, Converted at Boundaries" strategy: the frontend internal logic always operates on forward-slash paths (C:/Docs/note.md), converting at the IPC boundary via toSlashPath / toNativePath. User-facing display locations (e.g., showing parent paths for two files with the same name in different folders) are converted back to Windows-style backslashes. Regarding file line endings, new files remain LF, while files that were originally CRLF are preserved as-is.

3. Alt+F4, Close Button, and Ctrl+Q Unified Under Unsaved Check

There are three common ways to close an App on Windows: clicking the X in the top-right, pressing Ctrl+Q, or pressing Alt+F4.

To prevent any of these from bypassing the multi-tab draft protection, we hooked all three paths into the same unsaved confirmation process:

  • The window close button is intercepted by Tauri's onWindowCloseRequested. If the user clicks cancel in the "The following N documents have unsaved changes" dialog, event.preventDefault() is called to keep the window open.
  • Added a Windows-specific Alt+F4 keydown interceptor in src/main.ts, which, like the menu's Ctrl+Q, settles all unsaved changes across all tabs before actually exiting the program.

4. Font Fallbacks and Layout Tweaks

Added Windows Traditional Chinese and English font fallbacks in src/styles/tokens.css and print styles:

  • Body and UI fonts now include "Segoe UI", "Microsoft JhengHei UI", "Microsoft JhengHei".
  • Code monospace fonts now include "Cascadia Mono", "Cascadia Code", Consolas.

Additionally, since Windows uses a native title bar without the three macOS traffic lights in the top-left, we adjusted the alignment spacing for the tab bar and the top-right theme button, and ensured the top-left quick buttons (Toggle Sidebar, Open File) only show on Windows, keeping the macOS appearance and behavior 100% unchanged.


V. Release Strategy and the Honest Note on Lack of Physical Windows Verification

The release phase (W1 PR #93 and W4 PR #96) cleared the pain points of manual packaging: pushing a v* tag (or manually running workflow_dispatch) triggers .github/workflows/release.yml. It first checks that the tag matches the version in package.json, tauri.conf.json, and Cargo.toml, then runs three targets in parallel—macOS aarch64, macOS x86_64 (fixing the ad-hoc signature corruption issue mentioned in the previous post by setting bundle.macOS.signingIdentity: "-", and automatically running codesign --verify --deep --strict and .dmg content checks in CI), and Windows x86_64 (producing NSIS -setup.exe and WiX .msi). Finally, it aggregates SHA256SUMS.txt and creates a Draft Release, which a maintainer manually reviews before publishing. All third-party actions are pinned to commit SHAs, and only the final job creating the Release is granted contents: write permissions.

Three pragmatic choices were made for the Windows installer design:

  1. WebView2 uses downloadBootstrapper (Silent Mode): Set webviewInstallMode: { "type": "downloadBootstrapper", "silent": true } in src-tauri/tauri.conf.json. Windows 11 has WebView2 built-in; for Windows 10 systems without it (like LTSC or unupdated machines), the installer will automatically download and install it when needed, without bloating the installer with the full offline runtime.
  2. NSIS uses currentUser Installation Mode: Setting installMode: "currentUser" allows users to install without administrator privileges (no UAC elevation required) and includes English and Traditional Chinese (["English", "TradChinese"]). The installer automatically registers 7 Markdown extensions (.md, .markdown, .mdown, etc.) via fileAssociations. Combined with tauri-plugin-single-instance and CLI argv parsing, double-clicking an .md file in File Explorer opens it directly in the running window.
  3. Unsigned and SmartScreen Warnings: We haven't purchased a Windows code signing certificate yet, so Windows users will definitely see a Windows Defender SmartScreen warning when running the -setup.exe or .msi. Rather than letting people be scared off by the blue screen, we put "Experimental, Unsigned" at the very front of the four-language README, product page, and every Release Note, explicitly explaining to "Click 'More info' → 'Run anyway'" and providing SHA256SUMS.txt for those who want to verify the checksum themselves.

One Thing to Be Honest About: Lack of Physical Windows Verification

Writing this, I must be clear about the verification boundaries:

From v0.4.0 to the latest v0.8.1, the Windows version of Kalamos has not yet been verified on a physical Windows machine by me.

I usually develop and test on macOS. All current Windows quality assurance comes from the windows-latest CI (Vitest, cargo test including real headless Edge PDF export tests, Clippy, Playwright E2E dual-platform simulation, and tauri build packaging NSIS / MSI). Automated CI helped us catch those five hard pitfalls in section three, which was extremely useful; but the "last mile" of desktop software—actually clicking through the NSIS install wizard on Windows 10 / 11, seeing the layout of the in-window native menu bar and high-DPI fonts, double-clicking .md in File Explorer to test the single instance, and verifying Windows in-app auto-updates—cannot be verified by headless CI.

This is why we honestly label the Windows version as "Experimental, Unsigned" in the README, product page, and Release Notes. If you happen to have a Windows computer, you are very welcome to download and try it from GitHub Releases. Whether it's smooth or you hit a snag, feel free to open an Issue and report it to us!


VI. Checklist for Porting a macOS Tauri App to Windows

I've summarized the lessons learned from W1 to W4 into a practical checklist for anyone building cross-platform Tauri desktop software:

  • 1. Review external Rust PRs: Read build.rs before running any build or test: Confirm no network access, subprocess execution, or bundled binaries before building locally.
  • 2. Split large cross-platform tasks into stages, prioritizing CI / release pipelines: Like W1, which had zero conflict with App code, getting Windows installers produced automatically provides feedback for every subsequent step.
  • 3. Don't assume Path::new("/") is an absolute path: On Windows, it's drive-relative; derive the root from a real path (like home.ancestors().last()) for cross-platform tests.
  • 4. Use headless Edge / Chrome for PDF printing without --blink-settings=scriptEnabled=false: It will silently exit 0 without producing a file; instead, write to Default/Preferences in an isolated --user-data-dir to disable JS, and use strict CSP.
  • 5. Watch out for Shift being ignored in CodeMirror single-letter shortcuts: Caps Lock or Windows synthetic events can cause Mod-o to hijack Mod-Shift-O; use a highest priority keydown to record shiftKey for protection.
  • 6. Playwright cross-platform simulation requires more than just changing userAgent: Be sure to use addInitScript to overwrite both navigator.platform and navigator.userAgentData, otherwise it will be exposed on Windows runners.
  • 7. Dual-platform CI running formatters (Biome / Prettier) must use .gitattributes: Use * text=auto eol=lf to suppress the false positives caused by core.autocrlf converting LF to CRLF.
  • 8. Honestly label as "Experimental" if not tested on physical hardware: CI can guard logic and packaging, but the install wizard, native menus, and SmartScreen experience require honest communication with users about the current status.

Summary

Looking back at the process of adding Windows support to Kalamos, the three most significant takeaways were:

  1. The open-source community pushed the door wide open: Without @mingchuanhuang-xpc's PR #79 laying a solid foundation (and subsequent help from @narumiruna in #85 for Biome integration, which helped us block the CRLF pitfall in dual-platform CI), Windows support wouldn't have gone from zero to one in such a short time.
  2. Dual-platform CI is the most honest judge: No matter how carefully you write on macOS, the five landmines—Path::new("/"), headless Edge flags, CodeMirror Shift, navigator.platform, and core.autocrlf—only surfaced once windows-latest was pulled into the CI.
  3. Cross-platform success relies on containing differences at the boundaries: Frontend internal unification of forward slashes, shared menu-spec.json for menus, unified shortcutLabel() for shortcuts, and Rust platform details tucked away in platform.rs and #[cfg(target_os)]—keeping 90% of core functionality as a single implementation prevents maintenance costs from doubling with the number of platforms.

That's it for the Windows architecture, UX, and packaging; in the next post, we'll discuss the final piece of the puzzle—W5 in-app auto-updates (tauri-plugin-updater) and what to watch out for in design, key isolation, and physical upgrades.

Articles in this series:

Top comments (0)