# Commands and Jump Lists

A single typed command registry connects the in-app launcher, keyboard shortcuts, title-bar action buttons and Windows Jump Lists.

## Add a command

1. Add a command metadata entry in `src/shared/commands.ts`. Provide its ID, title, description, icon and category.
2. Handle the new ID in the `run()` switch in `src/renderer/src/App.svelte`.
3. Add a shortcut if appropriate in `handleKeydown()`; keep platform conventions consistent.
4. Run `pnpm typecheck`, `pnpm lint`, `pnpm test` and `task build`.

Commands become searchable and pinnable automatically. Do not add raw IPC method names or arbitrary shell commands to the renderer registry.

## Windows taskbar Jump Lists

Packaged Windows apps register five taskbar actions, grouped by purpose: **New workspace tab**, **Open folder**, **Open command launcher**, then **Open settings** and **About this application**. `JUMP_LIST_COMMANDS` is an explicit allowlist; extending the command registry **does not** automatically expose every action through the OS.

The Jump List also has two contextual sections when there are folders to show:

- **Pinned Workspaces:** pinned workspace tabs that have a folder, up to the app's three-tab pin limit. Pin, unpin or reorder a tab in the title bar and the taskbar list updates.
- **Recent Workspaces:** folders opened via the app's folder picker, with folders already pinned omitted. Entries removed through Windows' Jump List are not added back on refresh, because Windows otherwise hides the entire custom section.

Task icons come from Windows' own `shell32.dll` (document, folder, search, Control Panel/settings and help); workspace entries use the File Explorer icon from `explorer.exe`, following VS Code's approach. These resources ship with Windows, so the template adds **no icon assets or dependencies** for Jump Lists. The icons are intentionally OS-native and can look different across Windows versions.

`src/main/index.ts` sets the app's Windows AppUserModelID, registers the Jump List with `app.setJumpList`, handles `--command=` and encoded `--folder64=` launch arguments, and routes them through the existing single-instance window. `src/main/jump-list.ts` builds the categories and picks icon indices. Folder arguments use URL-safe base64 to avoid command-line quoting issues. Recently selected folders and pinned tabs are persisted in the user settings.

Jump Lists are Windows-specific and require a **packaged** application. They are deliberately not registered by the development server. The reverse-DNS `app_id` generated by Copier must match the packaged application identity.

The manually dispatched [Windows UI screenshots workflow](../.github/workflows/windows-screenshots.yml) captures the native taskbar Jump List with WinApp CLI as [`screenshots/09-windows-jump-list.png`](../screenshots/09-windows-jump-list.png).

## IPC boundary

The renderer calls the typed `window.desktop` API exposed by the preload script. Add native capabilities with a narrow method in `src/shared/api.ts`, an implementation in `src/preload/index.ts`, and a validated handler in `src/main/index.ts`. Keep `nodeIntegration` disabled, `contextIsolation` enabled and the renderer sandboxed.

Related: [Architecture](https://ruchirchawdhry.github.io/copier-electron-svelte/architecture/index.md), [Quality and CI](https://ruchirchawdhry.github.io/copier-electron-svelte/quality-and-ci/index.md).
