一键导入
desktop-utility-implementation
Implement or improve tray, quick popup, global shortcut, single-instance, and restore behavior for the Windows-first Tauri 2 app.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Implement or improve tray, quick popup, global shortcut, single-instance, and restore behavior for the Windows-first Tauri 2 app.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use this skill for React + TypeScript implementation, refactoring, and review tasks involving components, hooks, props typing, children typing, refs, effects, context, reducers, events, forms, utility functions, async UI state, generic components, type modeling, module/export conventions, and React architecture decisions. Trigger this skill when creating or refactoring React TypeScript code and when choosing the right abstraction boundary for maintainable React applications.
Use this skill for any UI work in numpad — shadcn components, theming, shell layout, feature UI, settings dialogs, inspector panels, or Windows 11-like desktop productivity styling.
Implement or extend optional, review-first AI infrastructure for numpad without compromising deterministic engine authority.
Align docs/ with the real implementation — remove stale claims, add missing details, correct wrong file names, and update contracts.
Refactor and extend the deterministic calculation engine while preserving correctness and explicit domain boundaries.
Audit the numpad repository — implementation state, docs drift, architecture health, and next priorities.
| name | desktop-utility-implementation |
| description | Implement or improve tray, quick popup, global shortcut, single-instance, and restore behavior for the Windows-first Tauri 2 app. |
Use this skill for any work in src-tauri/src/utils/, window management, tray, menu, global shortcut, single-instance, or quick-popup behavior.
.codex/skills/desktop-utility-implementation/tauri-file-map.md — every Tauri file with its role, key functions, and platform notessrc-tauri/src/
lib.rs ← App entry: plugins, AppState, invoke_handler, menu/window events
main.rs ← Calls numpad_lib::run()
commands/
ai.rs ← AI Tauri commands
documents.rs ← Document CRUD commands
export.rs ← Export file-save command
utility.rs ← update_quick_calc_session, copy_text_to_clipboard
mod.rs ← pub mod declarations
services/
state.rs ← AppState { db_path, quick_calc_session }
document_repository.rs
document_service.rs
ai_service.rs ← AI streaming, enablement, key resolution
ai_settings_service.rs
ai_secret_service.rs ← OS keychain
ai_key_resolution.rs
ai_provider.rs ← AiProvider trait
openrouter_provider.rs
export_service.rs
settings_repository.rs
mod.rs
utils/
desktop.rs ← Window bootstrap, quick-popup reveal/toggle/hide
macos.rs ← macOS-only: menu bar icon, app menu, tray, default shortcut
clipboard.rs ← Native clipboard write
mod.rs
db/ ← SQLite init, migrations
| Behavior | Windows | macOS |
|---|---|---|
| Transparent main window | ✓ native backdrop | ✗ not supported |
| Tray icon | tauri_plugin_tray | menu bar icon via macos.rs |
| App menu | System menu | Custom app_menu() in macos.rs |
| Global shortcut | tauri_plugin_global_shortcut | Registered in macos.rs |
| Quick popup window | quick_popup window | Same |
| Single-instance | tauri_plugin_single_instance (to add) | Same pattern |
Never add Windows-only APIs to the shared desktop.rs path. Isolate platform code in macos.rs (and a future windows.rs).
The quick popup is a separate Tauri window (quick_popup) that renders index.html?view=quick-popup:
Global shortcut triggered
→ tauri_plugin_global_shortcut callback (in macos.rs or windows equivalent)
→ calls utils::desktop::toggle_quick_popup(app_handle)
→ show/hide the quick_popup window
→ frontend QuickCalcScreen renders at ?view=quick-popup
→ user types expression → quick-calc-evaluation.ts evaluates deterministically
→ result shown → user copies or closes (Escape)
Frontend files:
src/features/quick-calc/QuickCalcScreen.tsx — popup UIsrc/features/quick-calc/quick-calc-evaluation.ts — deterministic evaluatorsrc/features/quick-calc/quick-calc.native.ts — typed Tauri wrappers// In commands: retrieve state
#[tauri::command]
pub async fn my_command(state: tauri::State<'_, AppState>) -> Result<(), String> {
let db_path = state.db_path.lock().await;
// ...
}
// Never use global statics or lazy_static for app state
// In lib.rs — ALL plugins registered here
tauri::Builder::default()
.plugin(tauri_plugin_store::Builder::default().build())
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
.plugin(tauri_plugin_notification::init())
.plugin(tauri_plugin_sql::Builder::default().build())
// Add new plugins here
.setup(|app| { ... })
// Commands are thin — delegate everything to services
#[tauri::command]
pub async fn my_command(
param: String,
state: tauri::State<'_, AppState>,
) -> Result<MyResponse, String> {
services::my_service::do_work(¶m, &state)
.await
.map_err(|e| e.to_string())
}
tauri-file-map.md to locate the right file.src-tauri/src/lib.rs for current plugin and command registration.src-tauri/src/utils/desktop.rs for window behavior.src-tauri/src/utils/macos.rs for macOS-specific behavior.cd src-tauri && cargo check && cargo build.npm run typecheck && npm run build.docs/ARCHITECTURE.md and docs/API_CONTRACTS.md.commands/ are thin wrappers — all logic in services/.utils/macos.rs (or future utils/windows.rs).AppState via tauri::State.docs/ARCHITECTURE.md — for native layer changesdocs/API_CONTRACTS.md — for new/changed Tauri commandsdocs/IMPLEMENTATION_ROADMAP.md — for desktop utility milestone progressdocs/STATUS_GAP_ANALYSIS.md — when gaps are resolved