[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AMT1AJ8S5GSRFKK3ME0BAP":3,"skill-same:01M7AMT1AJ8S5GSRFKK3ME0BAP":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M7AMT1AJ8S5GSRFKK3ME0BAP","desktop-cross-platform-and-architecture",null,"Use when choosing or using a cross-platform desktop framework (Electron vs Tauri, Flutter, Avalonia, Compose Multiplatform, Rust GUIs — the comparison table and the web-shell security checklist), structuring a desktop app (layering, state management, the document model with undo and autosave, threading and responsiveness, IPC and multi-process design, single instance and the launch protocol), or making an app feel native — windows, menus and keyboard, files, drag and drop and clipboard, dark mode and HiDPI, internationalization, accessibility, and the performance targets users perceive.","the-vibey-project\u002Fvibey","the-vibey-project","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F329298758?v=4","01M7AJHGZ9722CTJ4JNQZVRH0Q","the vibey project","01M7AJHGZVMG2K7TGXQ6XFHVG3",5,"MIT","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fdesktop-apps-macos-linux\u002Fskills\u002Fdesktop-cross-platform-and-architecture\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: desktop-cross-platform-and-architecture\ndescription: \"Use when choosing or using a cross-platform desktop framework (Electron vs Tauri, Flutter, Avalonia, Compose Multiplatform, Rust GUIs — the comparison table and the web-shell security checklist), structuring a desktop app (layering, state management, the document model with undo and autosave, threading and responsiveness, IPC and multi-process design, single instance and the launch protocol), or making an app feel native — windows, menus and keyboard, files, drag and drop and clipboard, dark mode and HiDPI, internationalization, accessibility, and the performance targets users perceive.\"\n---\n\n# Desktop Apps (macOS & Linux): Cross-Platform Frameworks, Architecture, and Native Idioms\n\n> **Part 3 of 5** of the *Desktop Application Programming — macOS & Linux* reference (plugin `desktop-apps-macos-linux`), covering §7–§9. Sibling skills: `desktop-macos-platform` (§0–§3), `desktop-linux-platform` (§4–§6), `desktop-packaging-security-and-testing` (§10–§13), `desktop-reference` (§14–§20). Section numbers are shared across the set; a reference written as §N → `skill` points into that sibling skill.\n>\n> **Currency:** Verified August 2026. See §18 → `desktop-reference` for the currency snapshot and what goes stale first.\n\n> **How to read this.** Reference, not tutorial. Sections are independent. Three markers:\n> - **[UNIVERSAL]** — true of desktop software regardless of platform or toolkit.\n> - **[PLATFORM]** — specific to macOS or a particular Linux stack. Verify against current docs.\n> - **[CONTESTED]** — competent engineers disagree. Both cases given; don't adjudicate for the reader.\n>\n> **⚠️ GOTCHA** boxes mark the failure modes that actually cost people days.\n>\n> **The single most important framing in this document:** macOS is *one* platform with\n> *one* vendor, *one* HIG, and *one* blessed path. Linux is *not a platform* — it is a\n> family of overlapping conventions (freedesktop specs), two dominant toolkits, two\n> display protocols, three packaging formats, and a dozen desktop environments. Advice\n> that treats them symmetrically is wrong. Almost every difficulty in cross-platform\n> desktop work traces back to this asymmetry.\n\n---\n\n## §7. Cross-Platform Frameworks\n\n### 7.1 The comparison table\n\n| Framework | Language | Rendering | Bundle (typical) | Idle RAM (typical) | Native feel | Maturity |\n|---|---|---|---|---|---|---|\n| **Electron** | JS\u002FTS + Node | Bundled Chromium | 80–200 MB | 150–300 MB | Low (unless heavily worked) | Very high (13 yrs) |\n| **Tauri 2** | JS\u002FTS + Rust | **OS WebView** | 2–10 MB | 30–50 MB | Medium | High, younger |\n| **Wails 3** | JS\u002FTS + Go | OS WebView | small | low | Medium | Medium |\n| **Neutralino** | JS\u002FTS + thin C++ | OS WebView | 1–5 MB | very low | Low | Low |\n| **Qt 6** | C++ \u002F Python \u002F QML | Own (raster\u002FRHI) | 20–60 MB | 40–80 MB | High (Widgets) | Very high (31 yrs) |\n| **Flutter** | Dart | Own (Impeller\u002FSkia) | 20–50 MB | 60–120 MB | Low (identical everywhere by design) | High on mobile, medium on desktop |\n| **Avalonia** | C#\u002FXAML | Own (Skia → Impeller in progress) | ~40 MB + runtime | medium | Medium (drawn, WPF-like) | High for desktop |\n| **.NET MAUI** | C#\u002FXAML | Native controls per platform | — | — | Medium | Mobile-first; **no first-party Linux** |\n| **Compose Multiplatform** | Kotlin | Own (Skia) | JVM-sized | higher | Low-Medium | Growing fast |\n| **Slint** | Rust\u002FC++\u002FJS + DSL | Own | small | low | Medium | Medium; embedded-focused |\n| **egui \u002F iced \u002F Xilem \u002F GPUI** | Rust | Own | small | low | Low | Varies; see §7.4 |\n\n*(Figures are representative ranges from published 2026 comparisons, not measurements of\nyour app. **Benchmark your own workload** — this is the one place vendor numbers are least\ntrustworthy.)*\n\n### 7.2 Electron vs Tauri — the argument everyone is having\n\n**[CONTESTED], and the numbers are real but not the whole story.**\n\n**Case for Electron:**\n- **Rendering consistency.** It ships its own Chromium, so CSS, WebGL, WebRTC, service\n  workers, and codecs behave identically on every OS. For a visually complex or\n  media-heavy app this eliminates an entire cross-platform testing burden.\n- **Thirteen years of ecosystem**: `electron-builder`, `electron-updater`, code-signing\n  recipes, crash reporting, native modules, Stack Overflow answers for every failure mode.\n- **Proven at the top end**: VS Code, Slack, Discord, Notion, Postman, 1Password, Obsidian,\n  Figma desktop. These are not accidents; they're evidence the trade-offs are survivable\n  at billion-user scale.\n- Bundle size rarely blocks a *desktop* install the way it would on mobile.\n\n**Case for Tauri 2:**\n- **Order-of-magnitude smaller bundles and ~4–5× lower idle memory**, because it uses the\n  OS WebView (WKWebView on macOS, WebKitGTK on Linux, WebView2 on Windows) plus a Rust\n  backend with no bundled runtime.\n- **Capability-based permission model** — you declare exactly which commands the frontend\n  may invoke. This is materially easier to defend in a SOC 2 \u002F HIPAA audit than \"Node is\n  available in the renderer, we promise we turned it off.\"\n- Smaller attack surface; memory-safe backend.\n- **Tauri 2 (stable) added iOS and Android**, making one codebase span desktop and mobile.\n\n**Case against Tauri (the honest knocks):**\n- **WebView heterogeneity is the cost you pay for the small bundle.** WebKitGTK on Linux\n  is meaningfully behind Chromium; you will hit \"works in Chrome, broken in the Linux\n  build\" bugs. Your testing matrix expands even as your bundle shrinks.\n- Native integrations require Rust. If nobody on the team writes Rust, \"we'll just add a\n  small native command\" is not small.\n- Fewer battle scars at very large scale.\n\n**Migration reality**: porting a mid-size Electron app is commonly reported at ~2–3 months\n— you must reimplement every Node native integration in Rust, rework IPC, and chase\nWebView rendering differences. Do it when bundle size or memory is causing *actual user\npain*, not on principle.\n\n**Also in this space**: **Wails 3** (Go backend, clean DX, performance claims still mostly\nvendor-reported), and **`deno desktop`** (shipped in Deno 2.9, June 2026) — best ergonomics\nfor porting an existing web app, but explicitly experimental, and Deno's own docs concede\nTauri produces far smaller apps.\n\n### 7.3 If you go the web-shell route: the security baseline\n\n```js\n\u002F\u002F main.js — the settings that separate a safe Electron app from a browser\n\u002F\u002F with filesystem access. These are non-negotiable.\nconst win = new BrowserWindow({\n  webPreferences: {\n    contextIsolation: true,       \u002F\u002F MUST be true (default since Electron 12)\n    nodeIntegration: false,       \u002F\u002F MUST be false\n    sandbox: true,                \u002F\u002F renderer in an OS sandbox\n    webSecurity: true,            \u002F\u002F never disable to \"fix\" CORS\n    preload: path.join(__dirname, 'preload.js'),\n  }\n});\n\n\u002F\u002F preload.js — expose a MINIMAL, typed, validated surface. Never expose ipcRenderer.\nconst { contextBridge, ipcRenderer } = require('electron');\ncontextBridge.exposeInMainWorld('api', {\n  \u002F\u002F Good: one narrow, named operation\n  readConfig: () => ipcRenderer.invoke('config:read'),\n  \u002F\u002F BAD (do not do this): send: (ch, ...a) => ipcRenderer.send(ch, ...a)\n});\n\n\u002F\u002F main process — validate EVERY argument. The renderer is untrusted.\nipcMain.handle('config:read', async (event) => {\n  if (!isTrustedSender(event.senderFrame)) throw new Error('untrusted');\n  return await loadConfigFromKnownPath();   \u002F\u002F never a caller-supplied path\n});\n```\nPlus: a strict **Content-Security-Policy**; block `will-navigate` and\n`setWindowOpenHandler` to external origins; never `shell.openExternal()` a URL that came\nfrom remote content; **keep Electron current** (you inherit every Chromium CVE, and old\nElectron versions are a standing supply-chain liability).\n\nTauri's equivalent discipline: keep the capability\u002Fpermission JSON tight, validate command\narguments in Rust, and don't enable `withGlobalTauri` in production.\n\n### 7.4 Rust GUI — the honest 2026 assessment\n\nThe ecosystem is real but **fragmented, and every option is a compromise.**\n\n| Library | Model | Best for | Weakness |\n|---|---|---|---|\n| **egui** (eframe) | Immediate mode | Tools, debug UIs, fastest zero→window | Non-native look; no retained accessibility model; re-renders continuously |\n| **iced** | Elm\u002Ffunctional | Structured apps; more native feel than egui | Documentation gaps; ecosystem thinner |\n| **Slint** | Declarative DSL | Polished product UI, embedded + desktop; commercial licensing available | DSL is another language; smaller community |\n| **Dioxus** | React-like | Web devs; can render via WebView or natively | WebView path inherits WebView trade-offs |\n| **Xilem** | Data-first, from the Druid team | Aligned with Rust's architecture; the \"future\" bet | Still maturing |\n| **GPUI** | GPU-first, from Zed | Extreme performance, custom rendering | Effectively Zed's framework; limited outside it |\n| **gtk4-rs \u002F cxx-qt** | Bindings | You want a *real* mature toolkit with Rust | You're using GTK\u002FQt, with binding friction |\n| **wxDragon \u002F fltk-rs** | Bindings to native | **Genuinely native controls → free screen-reader accessibility** | Older toolkits, dated aesthetics |\n\n**[CONTESTED] Is Rust GUI production-ready?** Advocates point to shipping apps and rapid\nimprovement. Skeptics point to a widely-circulated 2026 write-up in which a developer\nbenchmarked egui, iced, Slint, and GTK for a data-heavy table application (search, filter,\nsort, inline edit), hit walls in each, and shipped Electron for the UI with Rust for the\ncore. Both accounts are honest. **The reliable synthesis:** Rust GUI is ready for tools,\nutilities, and apps where you control the design; it is not yet a low-risk choice for\ndense, data-grid-heavy business applications, and **accessibility is the weakest link**\nacross every self-drawn Rust toolkit.\n\n---\n\n## §8. Application Architecture and Patterns\n\n### 8.1 The layering that survives contact with two platforms\n\n```\n┌───────────────────────────────────────────────────────┐\n│ Platform UI      SwiftUI\u002FAppKit  │  GTK4\u002FQt6           │ ← thin, idiomatic, per-platform\n├──────────────────────────────────┴──────────────────── ┤\n│ Presentation     view models \u002F stores \u002F commands       │ ← testable, platform-free\n├───────────────────────────────────────────────────────┤\n│ Domain           entities, rules, use cases            │ ← pure. no I\u002FO, no UI, no clock\n├───────────────────────────────────────────────────────┤\n│ Ports (traits\u002Fprotocols)  FileStore, Clock, Net, Prefs │ ← the seam\n├───────────────────────────────────────────────────────┤\n│ Adapters         real FS, real network, real keychain  │ ← platform-specific, thin\n└───────────────────────────────────────────────────────┘\n```\n**[UNIVERSAL] The domain layer must not import a UI framework, a clock, or a filesystem.**\nEverything it needs comes in through a port you can substitute in tests. This is the single\nhighest-leverage architectural decision in a desktop app, for the same reason it is in\nfirmware: it converts a 30-second click-through into a 30-millisecond test.\n\n### 8.2 State management\n\n| Pattern | Where it's idiomatic | Notes |\n|---|---|---|\n| **MVVM** | SwiftUI (`@Observable` view models), Qt\u002FQML, Avalonia, WPF-lineage | The desktop default. Keep view models free of framework types. |\n| **MVC** | AppKit, GTK (loosely) | Classic; degrades into massive controllers without discipline |\n| **Unidirectional \u002F Redux-ish** | Elm-inspired (iced), TCA on Apple platforms, Electron+Redux | Excellent for undo\u002Freplay\u002Ftime-travel; verbose |\n| **MVP \u002F MVVM-C** | Large enterprise apps | Explicit navigation ownership |\n\n**[UNIVERSAL] Single source of truth.** Desktop apps have multiple windows, inspectors,\nsidebars, and a menu bar all reflecting the same state. The moment two of them own\noverlapping state, you get the classic desktop bug: change something in the inspector, and\nthe sidebar shows the old value. One store; views derive.\n\n### 8.3 The document model, undo, and autosave\n\nDesktop apps that edit user data have obligations that web apps don't:\n\n- **Undo\u002Fredo is not optional** and it must be *unlimited* by default, *coalescing*\n  (typing 30 characters is one undo step, not 30), and *scoped per document window*.\n  - macOS: `UndoManager` — register undo closures at the model layer, not the view layer.\n  - Cross-platform: a command\u002Fmemento stack in your domain layer. Storing *inverse\n    operations* scales better than storing full snapshots.\n- **Autosave + versioning.** macOS gives you `NSDocument` autosave-in-place and Versions\n  browsing largely for free; SwiftUI's `DocumentGroup` inherits it. On Linux you implement\n  it: write to a temp file in the same directory, `fsync`, then `rename()` (atomic on the\n  same filesystem). **Never truncate-and-write the user's file in place** — a crash\n  mid-write destroys their data.\n- **Dirty state and window close.** Modified documents must prompt. macOS convention: the\n  close button shows a dot; the sheet offers Save\u002FDon't Save\u002FCancel.\n- **Crash recovery.** Periodically persist an unsaved-changes journal; offer restoration\n  on next launch. Users forgive crashes; they don't forgive lost work.\n\n```swift\n\u002F\u002F Undo done at the model layer, with coalescing — the shape that works\nfinal class TextModel {\n    private(set) var text: String = \"\"\n    weak var undoManager: UndoManager?\n    private var coalescingToken: Int = 0\n\n    func replace(with new: String, actionName: String, coalesce: Bool = false) {\n        let old = text\n        if coalesce && undoManager?.isUndoing == false {\n            \u002F\u002F group rapid edits into one undoable action\n            undoManager?.groupsByEvent = false\n        }\n        undoManager?.registerUndo(withTarget: self) { target in\n            target.replace(with: old, actionName: actionName)   \u002F\u002F inverse re-registers redo\n        }\n        undoManager?.setActionName(actionName)   \u002F\u002F \"Undo Typing\" in the Edit menu\n        text = new\n    }\n}\n```\n\n### 8.4 Threading and responsiveness\n\n**[UNIVERSAL] The main thread budget is ~8 ms per frame at 120 Hz, ~16 ms at 60 Hz.**\nEverything else goes off it.\n\n| Work | Where |\n|---|---|\n| Any file I\u002FO (yes, even \"small\" reads) | Background |\n| Network | Background |\n| Parsing, decoding, compression | Background |\n| Database queries | Background (or a dedicated actor\u002Fqueue) |\n| Layout, drawing, widget mutation | **Main only** |\n| Sorting\u002Ffiltering a 10k-row list | Background, deliver a prepared snapshot |\n\nPlatform mechanics: macOS → Swift Concurrency (`@MainActor` + `actor` + `Task`) or GCD.\nGTK → do work on a thread, marshal back with `glib::idle_add_local` \u002F\n`g_main_context_invoke`. Qt → `QThread`\u002F`QtConcurrent` + queued signal-slot connections\n(cross-thread signals are queued automatically, which is the point).\n\n> **⚠️ GOTCHA — the progress indicator that isn't.** A spinner rendered on the same\n> thread that's blocked doesn't spin. If your \"loading\" UI freezes, the work is on the\n> main thread. This is diagnostic, not cosmetic.\n\n**Cancellation is a first-class requirement on desktop.** Users close windows, switch\ndocuments, and retype search queries. Every long operation needs a cancellation token\nchecked at intervals, and a UI affordance to trigger it.\n\n### 8.5 IPC and multi-process design\n\nReasons to split processes: crash isolation, privilege separation, plugin sandboxing,\nusing a different language\u002Fruntime for part of the app.\n\n| Platform | Mechanism |\n|---|---|\n| macOS | **XPC** (lifecycle-managed, typed, launchd-integrated) |\n| Linux | **D-Bus** (discoverable, desktop-standard) or plain Unix sockets |\n| Cross-platform | Unix domain sockets + a length-prefixed framed protocol; or gRPC; or stdin\u002Fstdout with JSON-RPC (what LSP does, and it works fine) |\n\n**[UNIVERSAL] Design the protocol to be versioned and forward-compatible from message\none.** In a desktop app the two processes can end up at different versions during an\nupdate; ignoring unknown fields and negotiating a version at handshake avoids a whole\nclass of upgrade bugs.\n\n### 8.6 Single instance, and the launch protocol\n\nDesktop users expect: clicking the launcher when the app is running **raises the existing\nwindow**; opening a file when the app is running opens it in the running instance.\n\n- macOS: automatic. `NSApplication` handles reopen and `application(_:open:)`.\n- Linux: `GtkApplication`\u002F`GApplication` with `G_APPLICATION_HANDLES_OPEN` gives you\n  D-Bus-based single-instance and `Open`\u002F`Activate` for free. Qt requires\n  `QtSingleApplication`-style code or your own lock file + D-Bus name.\n- **⚠️ GOTCHA:** a lock file in `\u002Ftmp` is not a correct single-instance mechanism — it\n  survives crashes, breaks across users, and fails under Flatpak. Own a D-Bus name.\n\n---\n\n## §9. The Desktop Idioms — what makes an app feel native\n\nThis section is the difference between \"a program with a window\" and \"a Mac app\" \u002F \"a\nGNOME app.\" It is mostly unglamorous and almost entirely what users notice.\n\n### 9.1 Windows\n\n- **Restore state**: size, position, which display, scroll offset, open documents,\n  sidebar width, selected tab. macOS: `NSWindow.setFrameAutosaveName` \u002F\n  `@SceneStorage`; Linux: persist to `$XDG_STATE_HOME` yourself (Wayland will not let\n  you set absolute position — restore *size* and let the compositor place it).\n- **Multi-window is the norm on desktop**, not an edge case. Two documents open side by\n  side must not share mutable state.\n- **Minimum sizes** that are actually usable, and **resizability** that reflows rather\n  than clips.\n- **Multi-monitor**: different scale factors per display, windows dragged between them\n  mid-render, monitors disconnected while a window is on them. Test all three.\n\n### 9.2 Menus and keyboard\n\n**[PLATFORM] The macOS menu bar is a contract.** Users expect: an App menu with\nAbout\u002FSettings(⌘,)\u002FServices\u002FHide\u002FQuit(⌘Q); File with New(⌘N)\u002FOpen(⌘O)\u002FClose(⌘W)\u002FSave(⌘S);\nEdit with Undo(⌘Z)\u002FRedo(⇧⌘Z)\u002FCut\u002FCopy\u002FPaste\u002FSelect All; a Window menu with\nMinimize(⌘M)\u002FZoom and the window list; a Help menu with searchable help. **Every command\nin your app should be in a menu**, even if it's also a toolbar button — that's how Help\nsearch and accessibility find it, and how power users discover shortcuts.\n\n**[PLATFORM] On Linux, menu conventions are contested.** GNOME's HIG moved away from menu\nbars toward header bars with a hamburger menu; KDE retains traditional menu bars. If you\nuse libadwaita you follow GNOME; if you use Qt\u002FKDE you follow the traditional model. Either\nis defensible; **inconsistency within your own app is not.**\n\n**Keyboard, everywhere [UNIVERSAL]:**\n- Full keyboard navigation: Tab order that matches visual order, Escape closes\u002Fcancels,\n  Enter activates the default, arrow keys move within lists\u002Fgrids.\n- Visible focus indicators. (Removing the focus ring because it's \"ugly\" is an\n  accessibility regression; style it instead.)\n- Don't steal system shortcuts. On Linux, don't grab Super\u002FMeta.\n- Platform modifier differences: ⌘ on macOS vs Ctrl on Linux, ⌥ vs Alt, and — the one\n  people always miss — **Home\u002FEnd\u002FPageUp\u002FPageDown and word-movement semantics differ**\n  (⌥← vs Ctrl+←, ⌘← vs Home).\n\n### 9.3 Files, drag & drop, clipboard\n\n- **Use the platform file dialog.** On macOS, `NSOpenPanel`\u002F`fileImporter`. On Linux, the\n  **FileChooser portal** — even if you're not sandboxed, because it gives the user their\n  desktop's real dialog, with their bookmarks and recent files. A custom file browser is\n  almost always a mistake.\n- **Drag & drop both ways.** Accept drops from Finder\u002FFiles; support dragging *out* to\n  other apps. Declare the right UTIs (macOS) \u002F MIME types (Linux).\n- **Clipboard**: offer multiple representations (rich text *and* plain text; image *and*\n  file reference). Respect that on Linux the clipboard lives in the source app — copying\n  and then quitting loses the data unless a clipboard manager is running.\n- **Recent files**: macOS `NSDocumentController` handles it; Linux uses\n  `GtkRecentManager` \u002F the `recently-used.xbel` spec.\n\n### 9.4 Appearance: dark mode, HiDPI, theming\n\n- **Dark mode**: use **semantic colors** (`NSColor.labelColor`, `Color.primary`,\n  GTK's `@theme_fg_color`, Qt's palette roles), never hardcoded hex. React to live\n  changes (macOS: `NSApp.effectiveAppearance` KVO \u002F SwiftUI `@Environment(\\.colorScheme)`;\n  Linux: the **Settings portal**'s `color-scheme` key, which works for sandboxed apps too).\n- **HiDPI**: ship vector assets or @2x\u002F@3x rasters; never assume integer scale factors\n  (fractional scaling is normal on Linux); test at 100%, 125%, 150%, 200%, and with two\n  displays at different scales.\n- **Reduce Motion \u002F Reduce Transparency \u002F Increase Contrast**: honour them. On macOS these\n  are accessibility settings with APIs; on Linux, `gtk-enable-animations` and the\n  high-contrast theme.\n- **[CONTESTED] Linux theming.** Users expect apps to follow their system theme; libadwaita\n  apps largely don't, and Flatpak apps can't read host theme files from inside the sandbox\n  without an explicit runtime. GNOME's position is that arbitrary restyling breaks apps and\n  that the accent-color\u002Flight-dark API is the supported surface. Users' position is that\n  their desktop should look coherent. There is no resolution; know that you will receive\n  issues about it either way.\n\n### 9.5 Internationalization\n\n- **Externalize every user-visible string** from commit one. Retrofitting i18n is\n  brutal. macOS: `String(localized:)` + String Catalogs (`.xcstrings`). Linux: `gettext`\n  (`_(\"...\")`), `.po`\u002F`.mo`, or Qt's `tr()` + Linguist. Rust: `fluent`.\n- **Never concatenate translated fragments.** Use format strings with positional\n  arguments, because word order differs.\n- **Plurals** need real plural rules (Arabic has six forms), not `if n == 1`.\n- **RTL** (Arabic, Hebrew) mirrors your entire layout. Toolkits do it if you use logical\n  (leading\u002Ftrailing) rather than physical (left\u002Fright) constraints. Test with a\n  force-RTL flag before a user tells you.\n- **Locale affects more than language**: date formats, decimal separators (`,` vs `.` —\n  a classic parsing bug), sort order, first day of the week, paper size (A4 vs Letter),\n  and address\u002Fname formats.\n- Leave ~30–40% expansion room; German is long, and truncated buttons are the visible\n  symptom of a fixed-width layout.\n\n### 9.6 Accessibility\n\n**[UNIVERSAL] Non-negotiable, increasingly a legal requirement** (ADA\u002FSection 508 in the\nUS; the **European Accessibility Act** obligations that landed in 2025 for many consumer\nproducts in the EU). The floor:\n- Every interactive element has an accessible **name**, **role**, and **value**.\n- Keyboard-only operation of every feature.\n- Contrast ratios ≥ 4.5:1 for body text (WCAG AA).\n- Respect system font size settings; don't hardcode point sizes.\n- Announce dynamic changes (macOS: `NSAccessibility.post(element:notification:)`;\n  ARIA-live equivalents in web shells).\n\n**Testing**: macOS → **VoiceOver** (⌘F5) and Accessibility Inspector (bundled with Xcode).\nLinux → **Orca** plus Accerciser to inspect the AT-SPI tree. Web shells → the browser's\naccessibility tree devtools. **Custom-drawn UI has zero accessibility unless you build\nit** — this is the strongest practical argument for native widget toolkits.\n\n### 9.7 Performance targets that users perceive\n\n| Metric | Target | Why |\n|---|---|---|\n| Cold launch to interactive | \u003C 1 s (macOS), \u003C 2 s | Beyond this it \"feels slow\" |\n| Frame time | \u003C 16 ms (60 Hz), \u003C 8 ms (120 Hz ProMotion) | Dropped frames read as jank |\n| Input → visible response | \u003C 100 ms | Perceived as instantaneous |\n| Any operation > 1 s | Must show progress | Otherwise \"it froze\" |\n| Any operation > 10 s | Must be cancellable + backgroundable | |\n| Idle CPU | ~0% | A desktop app that burns CPU idle drains laptops and gets uninstalled |\n| Idle RAM | As low as the framework allows | The most common complaint about Electron apps |\n\n**The idle-CPU point deserves emphasis.** Timers that fire every 100 ms \"just in case\",\nanimations that never stop, polling loops, and immediate-mode GUIs that re-render\ncontinuously all produce measurable battery drain. Use event-driven updates and pause work\nwhen the window isn't visible (macOS: `occlusionState`; Wayland: `frame` callbacks stop\nfor hidden surfaces — respect them rather than rendering blind).\n","# Desktop Apps (macOS & Linux): Cross-Platform Frameworks, Architecture, and Native Idioms\n\n> **Part 3 of 5** of the *Desktop Application Programming — macOS & Linux* reference (plugin `desktop-apps-macos-linux`), covering §7–§9. Sibling skills: `desktop-macos-platform` (§0–§3), `desktop-linux-platform` (§4–§6), `desktop-packaging-security-and-testing` (§10–§13), `desktop-reference` (§14–§20). Section numbers are shared across the set; a reference written as §N → `skill` points into that sibling skill.\n>\n> **Currency:** Verified August 2026. See §18 → `desktop-reference` for the currency snapshot and what goes stale first.\n\n> **How to read this.** Reference, not tutorial. Sections are independent. Three markers:\n> - **[UNIVERSAL]** — true of desktop software regardless of platform or toolkit.\n> - **[PLATFORM]** — specific to macOS or a particular Linux stack. Verify against current docs.\n> - **[CONTESTED]** — competent engineers disagree. Both cases given; don't adjudicate for the reader.\n>\n> **⚠️ GOTCHA** boxes mark the failure modes that actually cost people days.\n>\n> **The single most important framing in this document:** macOS is *one* platform with\n> *one* vendor, *one* HIG, and *one* blessed path. Linux is *not a platform* — it is a\n> family of overlapping conventions (freedesktop specs), two dominant toolkits, two\n> display protocols, three packaging formats, and a dozen desktop environments. Advice\n> that treats them symmetrically is wrong. Almost every difficulty in cross-platform\n> desktop work traces back to this asymmetry.\n\n---\n\n## §7. Cross-Platform Frameworks\n\n### 7.1 The comparison table\n\n| Framework | Language | Rendering | Bundle (typical) | Idle RAM (typical) | Native feel | Maturity |\n|---|---|---|---|---|---|---|\n| **Electron** | JS\u002FTS + Node | Bundled Chromium | 80–200 MB | 150–300 MB | Low (unless heavily worked) | Very high (13 yrs) |\n| **Tauri 2** | JS\u002FTS + Rust | **OS WebView** | 2–10 MB | 30–50 MB | Medium | High, younger |\n| **Wails 3** | JS\u002FTS + Go | OS WebView | small | low | Medium | Medium |\n| **Neutralino** | JS\u002FTS + thin C++ | OS WebView | 1–5 MB | very low | Low | Low |\n| **Qt 6** | C++ \u002F Python \u002F QML | Own (raster\u002FRHI) | 20–60 MB | 40–80 MB | High (Widgets) | Very high (31 yrs) |\n| **Flutter** | Dart | Own (Impeller\u002FSkia) | 20–50 MB | 60–120 MB | Low (identical everywhere by design) | High on mobile, medium on desktop |\n| **Avalonia** | C#\u002FXAML | Own (Skia → Impeller in progress) | ~40 MB + runtime | medium | Medium (drawn, WPF-like) | High for desktop |\n| **.NET MAUI** | C#\u002FXAML | Native controls per platform | — | — | Medium | Mobile-first; **no first-party Linux** |\n| **Compose Multiplatform** | Kotlin | Own (Skia) | JVM-sized | higher | Low-Medium | Growing fast |\n| **Slint** | Rust\u002FC++\u002FJS + DSL | Own | small | low | Medium | Medium; embedded-focused |\n| **egui \u002F iced \u002F Xilem \u002F GPUI** | Rust | Own | small | low | Low | Varies; see §7.4 |\n\n*(Figures are representative ranges from published 2026 comparisons, not measurements of\nyour app. **Benchmark your own workload** — this is the one place vendor numbers are least\ntrustworthy.)*\n\n### 7.2 Electron vs Tauri — the argument everyone is having\n\n**[CONTESTED], and the numbers are real but not the whole story.**\n\n**Case for Electron:**\n- **Rendering consistency.** It ships its own Chromium, so CSS, WebGL, WebRTC, service\n  workers, and codecs behave identically on every OS. For a visually complex or\n  media-heavy app this eliminates an entire cross-platform testing burden.\n- **Thirteen years of ecosystem**: `electron-builder`, `electron-updater`, code-signing\n  recipes, crash reporting, native modules, Stack Overflow answers for every failure mode.\n- **Proven at the top end**: VS Code, Slack, Discord, Notion, Postman, 1Password, Obsidian,\n  Figma desktop. These are not accidents; they're evidence the trade-offs are survivable\n  at billion-user scale.\n- Bundle size rarely blocks a *desktop* install the way it would on mobile.\n\n**Case for Tauri 2:**\n- **Order-of-magnitude smaller bundles and ~4–5× lower idle memory**, because it uses the\n  OS WebView (WKWebView on macOS, WebKitGTK on Linux, WebView2 on Windows) plus a Rust\n  backend with no bundled runtime.\n- **Capability-based permission model** — you declare exactly which commands the frontend\n  may invoke. This is materially easier to defend in a SOC 2 \u002F HIPAA audit than \"Node is\n  available in the renderer, we promise we turned it off.\"\n- Smaller attack surface; memory-safe backend.\n- **Tauri 2 (stable) added iOS and Android**, making one codebase span desktop and mobile.\n\n**Case against Tauri (the honest knocks):**\n- **WebView heterogeneity is the cost you pay for the small bundle.** WebKitGTK on Linux\n  is meaningfully behind Chromium; you will hit \"works in Chrome, broken in the Linux\n  build\" bugs. Your testing matrix expands even as your bundle shrinks.\n- Native integrations require Rust. If nobody on the team writes Rust, \"we'll just add a\n  small native command\" is not small.\n- Fewer battle scars at very large scale.\n\n**Migration reality**: porting a mid-size Electron app is commonly reported at ~2–3 months\n— you must reimplement every Node native integration in Rust, rework IPC, and chase\nWebView rendering differences. Do it when bundle size or memory is causing *actual user\npain*, not on principle.\n\n**Also in this space**: **Wails 3** (Go backend, clean DX, performance claims still mostly\nvendor-reported), and **`deno desktop`** (shipped in Deno 2.9, June 2026) — best ergonomics\nfor porting an existing web app, but explicitly experimental, and Deno's own docs concede\nTauri produces far smaller apps.\n\n### 7.3 If you go the web-shell route: the security baseline\n\n```js\n\u002F\u002F main.js — the settings that separate a safe Electron app from a browser\n\u002F\u002F with filesystem access. These are non-negotiable.\nconst win = new BrowserWindow({\n  webPreferences: {\n    contextIsolation: true,       \u002F\u002F MUST be true (default since Electron 12)\n    nodeIntegration: false,       \u002F\u002F MUST be false\n    sandbox: true,                \u002F\u002F renderer in an OS sandbox\n    webSecurity: true,            \u002F\u002F never disable to \"fix\" CORS\n    preload: path.join(__dirname, 'preload.js'),\n  }\n});\n\n\u002F\u002F preload.js — expose a MINIMAL, typed, validated surface. Never expose ipcRenderer.\nconst { contextBridge, ipcRenderer } = require('electron');\ncontextBridge.exposeInMainWorld('api', {\n  \u002F\u002F Good: one narrow, named operation\n  readConfig: () => ipcRenderer.invoke('config:read'),\n  \u002F\u002F BAD (do not do this): send: (ch, ...a) => ipcRenderer.send(ch, ...a)\n});\n\n\u002F\u002F main process — validate EVERY argument. The renderer is untrusted.\nipcMain.handle('config:read', async (event) => {\n  if (!isTrustedSender(event.senderFrame)) throw new Error('untrusted');\n  return await loadConfigFromKnownPath();   \u002F\u002F never a caller-supplied path\n});\n```\nPlus: a strict **Content-Security-Policy**; block `will-navigate` and\n`setWindowOpenHandler` to external origins; never `shell.openExternal()` a URL that came\nfrom remote content; **keep Electron current** (you inherit every Chromium CVE, and old\nElectron versions are a standing supply-chain liability).\n\nTauri's equivalent discipline: keep the capability\u002Fpermission JSON tight, validate command\narguments in Rust, and don't enable `withGlobalTauri` in production.\n\n### 7.4 Rust GUI — the honest 2026 assessment\n\nThe ecosystem is real but **fragmented, and every option is a compromise.**\n\n| Library | Model | Best for | Weakness |\n|---|---|---|---|\n| **egui** (eframe) | Immediate mode | Tools, debug UIs, fastest zero→window | Non-native look; no retained accessibility model; re-renders continuously |\n| **iced** | Elm\u002Ffunctional | Structured apps; more native feel than egui | Documentation gaps; ecosystem thinner |\n| **Slint** | Declarative DSL | Polished product UI, embedded + desktop; commercial licensing available | DSL is another language; smaller community |\n| **Dioxus** | React-like | Web devs; can render via WebView or natively | WebView path inherits WebView trade-offs |\n| **Xilem** | Data-first, from the Druid team | Aligned with Rust's architecture; the \"future\" bet | Still maturing |\n| **GPUI** | GPU-first, from Zed | Extreme performance, custom rendering | Effectively Zed's framework; limited outside it |\n| **gtk4-rs \u002F cxx-qt** | Bindings | You want a *real* mature toolkit with Rust | You're using GTK\u002FQt, with binding friction |\n| **wxDragon \u002F fltk-rs** | Bindings to native | **Genuinely native controls → free screen-reader accessibility** | Older toolkits, dated aesthetics |\n\n**[CONTESTED] Is Rust GUI production-ready?** Advocates point to shipping apps and rapid\nimprovement. Skeptics point to a widely-circulated 2026 write-up in which a developer\nbenchmarked egui, iced, Slint, and GTK for a data-heavy table application (search, filter,\nsort, inline edit), hit walls in each, and shipped Electron for the UI with Rust for the\ncore. Both accounts are honest. **The reliable synthesis:** Rust GUI is ready for tools,\nutilities, and apps where you control the design; it is not yet a low-risk choice for\ndense, data-grid-heavy business applications, and **accessibility is the weakest link**\nacross every self-drawn Rust toolkit.\n\n---\n\n## §8. Application Architecture and Patterns\n\n### 8.1 The layering that survives contact with two platforms\n\n```\n┌───────────────────────────────────────────────────────┐\n│ Platform UI      SwiftUI\u002FAppKit  │  GTK4\u002FQt6           │ ← thin, idiomatic, per-platform\n├──────────────────────────────────┴──────────────────── ┤\n│ Presentation     view models \u002F stores \u002F commands       │ ← testable, platform-free\n├───────────────────────────────────────────────────────┤\n│ Domain           entities, rules, use cases            │ ← pure. no I\u002FO, no UI, no clock\n├───────────────────────────────────────────────────────┤\n│ Ports (traits\u002Fprotocols)  FileStore, Clock, Net, Prefs │ ← the seam\n├───────────────────────────────────────────────────────┤\n│ Adapters         real FS, real network, real keychain  │ ← platform-specific, thin\n└───────────────────────────────────────────────────────┘\n```\n**[UNIVERSAL] The domain layer must not import a UI framework, a clock, or a filesystem.**\nEverything it needs comes in through a port you can substitute in tests. This is the single\nhighest-leverage architectural decision in a desktop app, for the same reason it is in\nfirmware: it converts a 30-second click-through into a 30-millisecond test.\n\n### 8.2 State management\n\n| Pattern | Where it's idiomatic | Notes |\n|---|---|---|\n| **MVVM** | SwiftUI (`@Observable` view models), Qt\u002FQML, Avalonia, WPF-lineage | The desktop default. Keep view models free of framework types. |\n| **MVC** | AppKit, GTK (loosely) | Classic; degrades into massive controllers without discipline |\n| **Unidirectional \u002F Redux-ish** | Elm-inspired (iced), TCA on Apple platforms, Electron+Redux | Excellent for undo\u002Freplay\u002Ftime-travel; verbose |\n| **MVP \u002F MVVM-C** | Large enterprise apps | Explicit navigation ownership |\n\n**[UNIVERSAL] Single source of truth.** Desktop apps have multiple windows, inspectors,\nsidebars, and a menu bar all reflecting the same state. The moment two of them own\noverlapping state, you get the classic desktop bug: change something in the inspector, and\nthe sidebar shows the old value. One store; views derive.\n\n### 8.3 The document model, undo, and autosave\n\nDesktop apps that edit user data have obligations that web apps don't:\n\n- **Undo\u002Fredo is not optional** and it must be *unlimited* by default, *coalescing*\n  (typing 30 characters is one undo step, not 30), and *scoped per document window*.\n  - macOS: `UndoManager` — register undo closures at the model layer, not the view layer.\n  - Cross-platform: a command\u002Fmemento stack in your domain layer. Storing *inverse\n    operations* scales better than storing full snapshots.\n- **Autosave + versioning.** macOS gives you `NSDocument` autosave-in-place and Versions\n  browsing largely for free; SwiftUI's `DocumentGroup` inherits it. On Linux you implement\n  it: write to a temp file in the same directory, `fsync`, then `rename()` (atomic on the\n  same filesystem). **Never truncate-and-write the user's file in place** — a crash\n  mid-write destroys their data.\n- **Dirty state and window close.** Modified documents must prompt. macOS convention: the\n  close button shows a dot; the sheet offers Save\u002FDon't Save\u002FCancel.\n- **Crash recovery.** Periodically persist an unsaved-changes journal; offer restoration\n  on next launch. Users forgive crashes; they don't forgive lost work.\n\n```swift\n\u002F\u002F Undo done at the model layer, with coalescing — the shape that works\nfinal class TextModel {\n    private(set) var text: String = \"\"\n    weak var undoManager: UndoManager?\n    private var coalescingToken: Int = 0\n\n    func replace(with new: String, actionName: String, coalesce: Bool = false) {\n        let old = text\n        if coalesce && undoManager?.isUndoing == false {\n            \u002F\u002F group rapid edits into one undoable action\n            undoManager?.groupsByEvent = false\n        }\n        undoManager?.registerUndo(withTarget: self) { target in\n            target.replace(with: old, actionName: actionName)   \u002F\u002F inverse re-registers redo\n        }\n        undoManager?.setActionName(actionName)   \u002F\u002F \"Undo Typing\" in the Edit menu\n        text = new\n    }\n}\n```\n\n### 8.4 Threading and responsiveness\n\n**[UNIVERSAL] The main thread budget is ~8 ms per frame at 120 Hz, ~16 ms at 60 Hz.**\nEverything else goes off it.\n\n| Work | Where |\n|---|---|\n| Any file I\u002FO (yes, even \"small\" reads) | Background |\n| Network | Background |\n| Parsing, decoding, compression | Background |\n| Database queries | Background (or a dedicated actor\u002Fqueue) |\n| Layout, drawing, widget mutation | **Main only** |\n| Sorting\u002Ffiltering a 10k-row list | Background, deliver a prepared snapshot |\n\nPlatform mechanics: macOS → Swift Concurrency (`@MainActor` + `actor` + `Task`) or GCD.\nGTK → do work on a thread, marshal back with `glib::idle_add_local` \u002F\n`g_main_context_invoke`. Qt → `QThread`\u002F`QtConcurrent` + queued signal-slot connections\n(cross-thread signals are queued automatically, which is the point).\n\n> **⚠️ GOTCHA — the progress indicator that isn't.** A spinner rendered on the same\n> thread that's blocked doesn't spin. If your \"loading\" UI freezes, the work is on the\n> main thread. This is diagnostic, not cosmetic.\n\n**Cancellation is a first-class requirement on desktop.** Users close windows, switch\ndocuments, and retype search queries. Every long operation needs a cancellation token\nchecked at intervals, and a UI affordance to trigger it.\n\n### 8.5 IPC and multi-process design\n\nReasons to split processes: crash isolation, privilege separation, plugin sandboxing,\nusing a different language\u002Fruntime for part of the app.\n\n| Platform | Mechanism |\n|---|---|\n| macOS | **XPC** (lifecycle-managed, typed, launchd-integrated) |\n| Linux | **D-Bus** (discoverable, desktop-standard) or plain Unix sockets |\n| Cross-platform | Unix domain sockets + a length-prefixed framed protocol; or gRPC; or stdin\u002Fstdout with JSON-RPC (what LSP does, and it works fine) |\n\n**[UNIVERSAL] Design the protocol to be versioned and forward-compatible from message\none.** In a desktop app the two processes can end up at different versions during an\nupdate; ignoring unknown fields and negotiating a version at handshake avoids a whole\nclass of upgrade bugs.\n\n### 8.6 Single instance, and the launch protocol\n\nDesktop users expect: clicking the launcher when the app is running **raises the existing\nwindow**; opening a file when the app is running opens it in the running instance.\n\n- macOS: automatic. `NSApplication` handles reopen and `application(_:open:)`.\n- Linux: `GtkApplication`\u002F`GApplication` with `G_APPLICATION_HANDLES_OPEN` gives you\n  D-Bus-based single-instance and `Open`\u002F`Activate` for free. Qt requires\n  `QtSingleApplication`-style code or your own lock file + D-Bus name.\n- **⚠️ GOTCHA:** a lock file in `\u002Ftmp` is not a correct single-instance mechanism — it\n  survives crashes, breaks across users, and fails under Flatpak. Own a D-Bus name.\n\n---\n\n## §9. The Desktop Idioms — what makes an app feel native\n\nThis section is the difference between \"a program with a window\" and \"a Mac app\" \u002F \"a\nGNOME app.\" It is mostly unglamorous and almost entirely what users notice.\n\n### 9.1 Windows\n\n- **Restore state**: size, position, which display, scroll offset, open documents,\n  sidebar width, selected tab. macOS: `NSWindow.setFrameAutosaveName` \u002F\n  `@SceneStorage`; Linux: persist to `$XDG_STATE_HOME` yourself (Wayland will not let\n  you set absolute position — restore *size* and let the compositor place it).\n- **Multi-window is the norm on desktop**, not an edge case. Two documents open side by\n  side must not share mutable state.\n- **Minimum sizes** that are actually usable, and **resizability** that reflows rather\n  than clips.\n- **Multi-monitor**: different scale factors per display, windows dragged between them\n  mid-render, monitors disconnected while a window is on them. Test all three.\n\n### 9.2 Menus and keyboard\n\n**[PLATFORM] The macOS menu bar is a contract.** Users expect: an App menu with\nAbout\u002FSettings(⌘,)\u002FServices\u002FHide\u002FQuit(⌘Q); File with New(⌘N)\u002FOpen(⌘O)\u002FClose(⌘W)\u002FSave(⌘S);\nEdit with Undo(⌘Z)\u002FRedo(⇧⌘Z)\u002FCut\u002FCopy\u002FPaste\u002FSelect All; a Window menu with\nMinimize(⌘M)\u002FZoom and the window list; a Help menu with searchable help. **Every command\nin your app should be in a menu**, even if it's also a toolbar button — that's how Help\nsearch and accessibility find it, and how power users discover shortcuts.\n\n**[PLATFORM] On Linux, menu conventions are contested.** GNOME's HIG moved away from menu\nbars toward header bars with a hamburger menu; KDE retains traditional menu bars. If you\nuse libadwaita you follow GNOME; if you use Qt\u002FKDE you follow the traditional model. Either\nis defensible; **inconsistency within your own app is not.**\n\n**Keyboard, everywhere [UNIVERSAL]:**\n- Full keyboard navigation: Tab order that matches visual order, Escape closes\u002Fcancels,\n  Enter activates the default, arrow keys move within lists\u002Fgrids.\n- Visible focus indicators. (Removing the focus ring because it's \"ugly\" is an\n  accessibility regression; style it instead.)\n- Don't steal system shortcuts. On Linux, don't grab Super\u002FMeta.\n- Platform modifier differences: ⌘ on macOS vs Ctrl on Linux, ⌥ vs Alt, and — the one\n  people always miss — **Home\u002FEnd\u002FPageUp\u002FPageDown and word-movement semantics differ**\n  (⌥← vs Ctrl+←, ⌘← vs Home).\n\n### 9.3 Files, drag & drop, clipboard\n\n- **Use the platform file dialog.** On macOS, `NSOpenPanel`\u002F`fileImporter`. On Linux, the\n  **FileChooser portal** — even if you're not sandboxed, because it gives the user their\n  desktop's real dialog, with their bookmarks and recent files. A custom file browser is\n  almost always a mistake.\n- **Drag & drop both ways.** Accept drops from Finder\u002FFiles; support dragging *out* to\n  other apps. Declare the right UTIs (macOS) \u002F MIME types (Linux).\n- **Clipboard**: offer multiple representations (rich text *and* plain text; image *and*\n  file reference). Respect that on Linux the clipboard lives in the source app — copying\n  and then quitting loses the data unless a clipboard manager is running.\n- **Recent files**: macOS `NSDocumentController` handles it; Linux uses\n  `GtkRecentManager` \u002F the `recently-used.xbel` spec.\n\n### 9.4 Appearance: dark mode, HiDPI, theming\n\n- **Dark mode**: use **semantic colors** (`NSColor.labelColor`, `Color.primary`,\n  GTK's `@theme_fg_color`, Qt's palette roles), never hardcoded hex. React to live\n  changes (macOS: `NSApp.effectiveAppearance` KVO \u002F SwiftUI `@Environment(\\.colorScheme)`;\n  Linux: the **Settings portal**'s `color-scheme` key, which works for sandboxed apps too).\n- **HiDPI**: ship vector assets or @2x\u002F@3x rasters; never assume integer scale factors\n  (fractional scaling is normal on Linux); test at 100%, 125%, 150%, 200%, and with two\n  displays at different scales.\n- **Reduce Motion \u002F Reduce Transparency \u002F Increase Contrast**: honour them. On macOS these\n  are accessibility settings with APIs; on Linux, `gtk-enable-animations` and the\n  high-contrast theme.\n- **[CONTESTED] Linux theming.** Users expect apps to follow their system theme; libadwaita\n  apps largely don't, and Flatpak apps can't read host theme files from inside the sandbox\n  without an explicit runtime. GNOME's position is that arbitrary restyling breaks apps and\n  that the accent-color\u002Flight-dark API is the supported surface. Users' position is that\n  their desktop should look coherent. There is no resolution; know that you will receive\n  issues about it either way.\n\n### 9.5 Internationalization\n\n- **Externalize every user-visible string** from commit one. Retrofitting i18n is\n  brutal. macOS: `String(localized:)` + String Catalogs (`.xcstrings`). Linux: `gettext`\n  (`_(\"...\")`), `.po`\u002F`.mo`, or Qt's `tr()` + Linguist. Rust: `fluent`.\n- **Never concatenate translated fragments.** Use format strings with positional\n  arguments, because word order differs.\n- **Plurals** need real plural rules (Arabic has six forms), not `if n == 1`.\n- **RTL** (Arabic, Hebrew) mirrors your entire layout. Toolkits do it if you use logical\n  (leading\u002Ftrailing) rather than physical (left\u002Fright) constraints. Test with a\n  force-RTL flag before a user tells you.\n- **Locale affects more than language**: date formats, decimal separators (`,` vs `.` —\n  a classic parsing bug), sort order, first day of the week, paper size (A4 vs Letter),\n  and address\u002Fname formats.\n- Leave ~30–40% expansion room; German is long, and truncated buttons are the visible\n  symptom of a fixed-width layout.\n\n### 9.6 Accessibility\n\n**[UNIVERSAL] Non-negotiable, increasingly a legal requirement** (ADA\u002FSection 508 in the\nUS; the **European Accessibility Act** obligations that landed in 2025 for many consumer\nproducts in the EU). The floor:\n- Every interactive element has an accessible **name**, **role**, and **value**.\n- Keyboard-only operation of every feature.\n- Contrast ratios ≥ 4.5:1 for body text (WCAG AA).\n- Respect system font size settings; don't hardcode point sizes.\n- Announce dynamic changes (macOS: `NSAccessibility.post(element:notification:)`;\n  ARIA-live equivalents in web shells).\n\n**Testing**: macOS → **VoiceOver** (⌘F5) and Accessibility Inspector (bundled with Xcode).\nLinux → **Orca** plus Accerciser to inspect the AT-SPI tree. Web shells → the browser's\naccessibility tree devtools. **Custom-drawn UI has zero accessibility unless you build\nit** — this is the strongest practical argument for native widget toolkits.\n\n### 9.7 Performance targets that users perceive\n\n| Metric | Target | Why |\n|---|---|---|\n| Cold launch to interactive | \u003C 1 s (macOS), \u003C 2 s | Beyond this it \"feels slow\" |\n| Frame time | \u003C 16 ms (60 Hz), \u003C 8 ms (120 Hz ProMotion) | Dropped frames read as jank |\n| Input → visible response | \u003C 100 ms | Perceived as instantaneous |\n| Any operation > 1 s | Must show progress | Otherwise \"it froze\" |\n| Any operation > 10 s | Must be cancellable + backgroundable | |\n| Idle CPU | ~0% | A desktop app that burns CPU idle drains laptops and gets uninstalled |\n| Idle RAM | As low as the framework allows | The most common complaint about Electron apps |\n\n**The idle-CPU point deserves emphasis.** Timers that fire every 100 ms \"just in case\",\nanimations that never stop, polling loops, and immediate-mode GUIs that re-render\ncontinuously all produce measurable battery drain. Use event-driven updates and pause work\nwhen the window isn't visible (macOS: `occlusionState`; Wayland: `frame` callbacks stop\nfor hidden surfaces — respect them rather than rendering blind).\n",{"name":5,"description":7},"develop","ae32736a1aabddabca5d2c96d665aa0ebc7d8700","src\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fdesktop-apps-macos-linux\u002Fskills\u002Fdesktop-cross-platform-and-architecture",3,"https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey","https:\u002F\u002Fthe-vibey-project.github.io\u002Fvibey\u002F","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project","https:\u002F\u002Fvibewithadam.matthewsteinberger.com","freedom for software engineers","2026-11-15 05:47:42",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add the-vibey-project\u002Fvibey --skill desktop-cross-platform-and-architecture",{"tool":40,"command":41},"bunx","bunx skills add the-vibey-project\u002Fvibey --skill desktop-cross-platform-and-architecture",{"tool":43,"command":44},"pnpm","pnpm dlx skills add the-vibey-project\u002Fvibey --skill desktop-cross-platform-and-architecture","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fdesktop-apps-macos-linux\u002Fskills\u002Fdesktop-cross-platform-and-architecture\u002FSKILL.md",true,[],[49,56,63,70,77,84],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7AT1FQJAE1FQYAMDTF490Y4","white-paper-writing","Use when writing white papers, technical reports, policy documents, thought leadership pieces, or any long-form authoritative document. Triggers on requests to write, structure, outline, or review white papers, technical reports, position papers, policy briefs, or evidence-driven arguments. Also use for B2B content marketing strategy, technical documentation requiring authority, academic-style reports, or any document that must educate while persuading. Use when someone asks \"how should I structure this\" for a long-form document.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fwhite-paper-writing\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7AT16BJRJJKK2MASXRZS76G","prose-technical-mechanics","Use when editing or writing prose at a technical\u002Fmechanical level: choosing between Anglo-Saxon and Latinate diction, placing information in topic vs stress positions, writing periodic vs cumulative sentences, handling sentence rhythm, punctuation as logic, transitions, paragraph structure, or phonesthetics. Use when someone wants to understand WHY prose works or doesn't, not just surface-level style advice. Triggers on word choice, sentence structure, emphasis, rhythm, diction, or any deep writing mechanics question.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fprose-technical-mechanics\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7AT0W9HT0ZZ9Y287NW99MR3","prose-mechanics","Use when writing, editing, or analyzing prose style; when trying to avoid generic AI-sounding writing; when applying specific prose styles such as journalistic, academic, narrative, KJV biblical, Hemingway plain, Latinate\u002FJamesian, Orwellian, Augustan, Victorian, Early Modern (Bacon, Browne, Milton), or free indirect discourse; or when coaching someone on writing voice and mechanics. Triggers on any request to improve, analyze, or write in a specific prose style, to fix \"AI-sounding\" writing, to make prose more vivid or concrete, to vary sentence rhythm, or to understand how a particular writer achieves their effects.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fprose-mechanics\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7AT0KR635JX66X2X6F3E2CP","narrative-structure","Use when structuring stories, pitches, presentations, white papers, or any persuasive narrative; analyzing the hero's journey in fiction or non-fiction; applying StoryBrand for business communication; designing narrative arcs for thought leadership; or understanding Vogler, Snyder, Propp, or Campbell frameworks. Triggers on any narrative structure, storytelling, pitch structure, StoryBrand, hero's journey, three-act structure, Freytag, Save the Cat, narrative arc, or \"how should I structure this story\u002Fpitch\u002Fpresentation\" request.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fnarrative-structure\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7AT0AKGW09NKKZDYBT8VRDE","legal-brief-writing","Use when writing legal briefs, motions, or any court filing; when analyzing judicial cognition and persuasion; when applying elite brief-writing techniques from Roberts, Clement, Kagan, Garner; or when structuring legal arguments for maximum persuasion. Also use for autistic\u002Fneurodivergent advocates who need to understand how their natural communication style maps to elite legal advocacy. Triggers on any legal writing, brief drafting, motion preparation, or legal argument structuring request.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Flegal-brief-writing\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7AT00VWPS4Q8B5VEMXX9NQT","journal-publishability-criteria","Use whenever a research paper, article or preprint is being written, revised, reviewed or published, and specifically before every publication of docs\u002Fpaper.md. Covers what legitimate journals actually gate on, in order of gating — the editor's desk screen (scope, novelty, package problems), what reviewers judge (methodological soundness, claims the evidence can carry, statistical and qualitative reporting), EQUATOR reporting guidelines, the ICMJE authorship criteria, COPE's view of text recycling, the near-universal generative-AI policy (no AI author, disclosure, author responsibility), TOP 2025 transparency standards, how to verify a journal is legitimate, submitting without an institution, and a pre-submission checklist. Triggers on requests to evaluate, review, prepare or submit a paper, to judge publishability, to write a declarations or data-availability section, to disclose AI use, or to check a journal.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fjournal-publishability-criteria\u002FSKILL.md",[],[]]