What the agent does
A global shortcut in Tauri 2 is a plugin, so the agent starts by reading the three places a plugin touches. In an app like Uninen/tauri-vue-template, src-tauri/Cargo.toml depends on tauri 2 (2.10.3 in Cargo.lock), tauri-plugin-shell 2 (2.3.5) and tauri-plugin-prevent-default 5.0, with a release profile set to opt-level = "s", LTO, panic = "abort" and strip. src-tauri/src/lib.rs builds the app with tauri::Builder::default(), a setup closure that opens the devtools on the window labelled main in debug builds, the two plugins, and one greet command. src-tauri/tauri.conf.json names the product tauri-app with identifier com.tauri-app.my, one window of 800 by 600, and a CSP whose connect-src is ipc: http://ipc.localhost. There is no src-tauri/capabilities directory at all, so no window has been granted any plugin command yet. The frontend is Vue 3.5 with Pinia 3, Vite 8, TypeScript 6 and @tauri-apps/api 2.10, installed with pnpm under a pnpm-workspace.yaml that sets minimumReleaseAge: 1440. src/App.vue mounts GreetComponent.vue, whose form calls invoke('greet') and writes the name into the store in src/store.ts. Vitest runs tests/unit/example.test.ts with a testing Pinia installed from tests/setup/install-pinia.ts, and test.yml runs pnpm test on Node 24 with pnpm 10 while test-build.yml builds the Linux bundle on ubuntu-24.04.
The agent adds the plugin the way the Tauri CLI does it: pnpm tauri add global-shortcut puts tauri-plugin-global-shortcut into Cargo.toml and @tauri-apps/plugin-global-shortcut into package.json, and the agent registers it inside the existing setup closure under #[cfg(desktop)], because the plugin only exists for macOS, Windows and Linux targets. It builds the plugin with with_handler, whose closure receives the app handle, the shortcut and the event, and acts only when event.state() is the pressed state so a release does not fire a second time. The handler's job is the one most apps want first: find the main webview window, show it, unminimize it and set_focus, so the shortcut brings the app forward from any other application. Because no global-shortcut permission is enabled by default, the agent writes src-tauri/capabilities/default.json for the main window with core:default, the shell plugin's default permission the app already relies on, and global-shortcut:allow-register, global-shortcut:allow-unregister and global-shortcut:allow-is-registered, and nothing broader such as allow-register-all. The generated gen/ schemas stay out of git, as src-tauri/.gitignore already says.
On the Vue side the agent writes a useGlobalShortcut composable in src/composables/ around register, unregister and isRegistered from the plugin package. It takes an accelerator string, defaulting to CommandOrControl+Shift+G, checks isRegistered first so a hot reload does not register twice, registers on mount and unregisters in onUnmounted. Registration can fail when another application already owns the combination, so the composable catches the rejection and stores the message instead of throwing. The Pinia store gains shortcut and shortcutError fields, App.vue calls the composable once at the root, and GreetComponent.vue shows the active accelerator under the form with the error when there is one, so a user sees why nothing happens rather than guessing.
Then the agent proves what a Linux sandbox without a desktop session can prove. pnpm check runs cargo check with the new crate compiled in, pnpm build runs vue-tsc --noEmit and the Vite build against the new import, and a Vitest file mocks @tauri-apps/plugin-global-shortcut to cover three paths: a fresh accelerator registers once, an already-registered one is left alone, and a rejected registration lands in the store as an error. The agent cannot press the key combination, and the pull request says so plainly. One pnpm detail matters: with minimumReleaseAge of a day, a plugin version published in the last 24 hours resolves to the previous one, so the agent records the exact versions pnpm and cargo resolved and checks that the npm package and the crate agree on their major version.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Add a global keyboard shortcut to this Tauri 2 app that brings the main window to the front from any other application. Read src-tauri/Cargo.toml, src-tauri/src/lib.rs, src-tauri/tauri.conf.json, package.json, pnpm-workspace.yaml, everything under src and tests, and the workflows first, and note whether a capabilities directory exists. Add the global-shortcut plugin with the Tauri CLI so the crate and the npm package match, register it inside setup for desktop targets only with a handler that acts on key press and shows, unminimizes and focuses the main window, and write a capability for the main window granting core:default, the shell plugin's default permission and only the register, unregister and is-registered permissions of the new plugin. Write a Vue composable that checks whether the accelerator is registered, registers it on mount, unregisters on unmount and stores a failure message instead of throwing; call it from App.vue, keep the accelerator and any error in the Pinia store and show both in the greet component. Mock the plugin in a Vitest test covering first registration, an already registered accelerator and a rejected registration. Run cargo check through pnpm check, the Vite build with type checking and the tests, record the resolved plugin versions on both sides, and open a pull request that says what was verified and what needs a desktop to confirm.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
What comes back is a pull request that changes src-tauri/Cargo.toml, src-tauri/Cargo.lock, src-tauri/src/lib.rs, package.json and pnpm-lock.yaml, adds src-tauri/capabilities/default.json, src/composables/useGlobalShortcut.ts and tests/unit/global-shortcut.test.ts, and edits App.vue, GreetComponent.vue and store.ts. Its description names the accelerator, the versions resolved on each side, the five permissions in the capability with one line on why each is there, and the three things the sandbox verified: the crate compiles, the TypeScript builds, and the composable behaves under a mock.
The run's record keeps the cargo check, vue-tsc and Vite output and the Vitest run with its three cases, so a reviewer can see the Rust and TypeScript halves agree before opening the app.
Before merging, a reviewer runs pnpm tauri dev, switches to another application, presses the combination and watches the window come forward. Global shortcuts belong to the operating system, so the check is worth repeating on each platform the app ships to: another program may already hold the combination, and on a Linux Wayland session the compositor decides whether an application receives global key events at all. The test-build.yml workflow confirms the Linux bundle still builds.
Run it on every Linear issue labelled tauri
A team that tracks desktop work in Linear adds an automation with a linear trigger on linear.issue.labeled for the label tauri, pointed at the Project that holds this repository, with this prompt. Labelling the issue that asks for the shortcut starts one run; the issue's text is added after the prompt, so a request for a different accelerator or a different action on press reaches the agent without editing the automation.
The trigger fills in no placeholder in the prompt, so the same automation handles the next plugin the team wants, as long as each issue says what the app should do.
The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.
Why run it on Rush?
A Tauri plugin is three edits that must agree, a crate version, an npm package version and a permission list, and a global shortcut adds a fourth source of surprise, the operating system refusing a combination another program holds. The agent reads the real Cargo.lock, package.json and the empty capabilities directory in its own sandbox, makes the edits together, compiles both halves and exercises the failure path under a mock before anyone opens the app.
The pull request draws the line between what the sandbox proved and what needs a desktop, with the commands and their output in the run's record. That is the honest shape for a change whose last step is a key press on a machine the agent does not have, and it is the same shape every time, whichever teammate labels the issue.
Frequently asked questions
Why is the plugin registered inside setup and behind cfg(desktop)?
The global-shortcut plugin is built for macOS, Windows and Linux only, so registering it unconditionally would break a mobile build of the same crate. Putting it in the setup closure under #[cfg(desktop)] keeps the builder in lib.rs compiling for every target and matches how the plugin documents its own setup.
What happens if another app already uses the combination?
The register call rejects, the composable catches it, and the store's shortcutError holds the message, which the greet component shows. The app keeps working without the shortcut, and the Vitest case for a rejected registration covers exactly this path.
Does the agent actually press the shortcut?
No, and the pull request says so. The sandbox has no desktop session to deliver a global key event. The agent verifies that the crate compiles with the plugin, that the TypeScript builds against the new package, and that the composable registers, skips and records failures correctly under a mock; the reviewer's pnpm tauri dev is the real key press.
Why only three permissions and not allow-register-all?
The capability names allow-register, allow-unregister and allow-is-registered, which is everything the composable calls. Granting the all variants would let any frontend code register arbitrary combinations, and the whole point of Tauri 2 capabilities is to grant a window what it uses and no more.
More Tauri jobs
More jobs like this: Turn a Linear label into a PR
- Add golangci-lint to a Go CLI's CI (Go CLI)
- Add Google Login to an AdonisJS App (AdonisJS)
- Add Google Login to a Next.js App with NextAuth.js (NextAuth.js)