# Add Native Notifications to a Tauri App

Yes. An agent adds the Tauri notification plugin on the Rust and Vue sides, grants the permission in a capability file, tests the permission flow and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/add-notifications/tauri/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads both halves of the app before adding a plugin, because a Tauri 2 plugin touches the Rust crate, the frontend package and the permission system. In an app like Uninen/tauri-vue-template, `src-tauri/Cargo.toml` depends on `tauri` 2 (resolved to 2.10.3 in `Cargo.lock`), `tauri-plugin-shell` 2 and `tauri-plugin-prevent-default` 5, with a release profile that enables LTO, `opt-level = "s"`, `panic = "abort"` and `strip`. `src-tauri/src/lib.rs` builds the app with `tauri::Builder::default()`, a `setup` that opens the devtools in debug builds, the two plugins, and one command, `greet`, exposed through the `generate_handler` macro. `src-tauri/tauri.conf.json` names the product `tauri-app`, the identifier `com.tauri-app.my`, one 800 by 600 window and a CSP with `default-src 'self'` and `connect-src ipc: http://ipc.localhost`. There is no `src-tauri/capabilities` directory, and `.gitignore` excludes the generated `gen/` schemas. The frontend is Vue 3 with Pinia 3, Vite 8 and TypeScript, `package.json` has `@tauri-apps/api` and `@tauri-apps/plugin-shell` plus `@tauri-apps/cli`, `pnpm-workspace.yaml` sets `minimumReleaseAge: 1440`, and `src/components/GreetComponent.vue` is the one place that calls `invoke('greet')`, storing the name in the Pinia store in `src/store.ts`. Vitest runs `tests/unit/example.test.ts` with a testing Pinia installed in `tests/setup/`.

The agent adds the plugin the way the Tauri CLI expects: `pnpm tauri add notification` adds `tauri-plugin-notification` to `Cargo.toml` and `@tauri-apps/plugin-notification` to `package.json`, and the agent adds `.plugin(tauri_plugin_notification::init())` to the builder in `lib.rs` beside the two existing plugins. Permissions are the part that is missing from the template: it writes `src-tauri/capabilities/default.json` with the identifier `default`, the `main` window, and `core:default`, the shell plugin's default permission since the app already registers that plugin, and `notification:default`, so the frontend may ask for permission and send. The pnpm setting matters here: with `minimumReleaseAge` of a day, a plugin version published in the last 24 hours is not installable, and the agent records which version pnpm resolved.

On the Vue side it writes a `useNotifications` composable in `src/composables/` that wraps `isPermissionGranted`, `requestPermission` and `sendNotification` from the plugin: it checks once, asks only when not yet granted, and exposes a `send(title, body)` that returns whether the notification went out. `GreetComponent.vue` gets a second button that sends the greeting as a notification, and the Pinia store gains a `notificationsGranted` flag so other components can read the state without asking again. The CSP needs no change, because the plugin talks over the IPC the CSP already allows.

Then it proves what the sandbox can prove. `pnpm check` runs `cargo check` on the Rust crate with the new plugin compiled in, `pnpm build` runs `vue-tsc --noEmit` and the Vite build against the new imports, and a Vitest file mocks `@tauri-apps/plugin-notification` to test the composable: permission already granted sends at once, permission denied sends nothing and reports it, permission unknown asks once and remembers. The sandbox has no desktop session with a notification daemon, so the agent does not claim to have seen a notification appear; the repository's `test-build.yml` workflow builds the Linux bundle on `ubuntu-24.04` with the webkit2gtk dependencies, and the pull request is written so that build is the next check.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Add native notifications to this Tauri 2 app. Read src-tauri/Cargo.toml, src-tauri/src/lib.rs, src-tauri/tauri.conf.json, package.json, pnpm-workspace.yaml, every file under src and tests, and the workflows first, and note whether a capabilities directory exists. Add the notification plugin with the Tauri CLI so the crate and the npm package match, register it in the builder, and write a default capability for the main window that grants core:default, the default permission of the shell plugin the app already registers, and notification:default. Write a Vue composable that checks permission, requests it only when needed and sends a notification, add a button in the greet component that uses it, and keep the granted state in the Pinia store. Mock the plugin in a Vitest test covering granted, denied and not-yet-asked. Run cargo check through pnpm check, the Vite build with type checking, and the tests, record the plugin version pnpm resolved, and open a pull request that says what could and could not be verified without a desktop session.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **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.
2. **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.
3. **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` and `package.json` with its lockfile, adds `src-tauri/capabilities/default.json`, `src/composables/useNotifications.ts` and `tests/unit/notifications.test.ts`, and edits `GreetComponent.vue` and `store.ts`. The description names the plugin version on both sides, lists the three permissions granted and why each is there, and says plainly that the sandbox verified compilation, the build and the mocked flow, not a notification on screen.

The run's record keeps `cargo check`, `vue-tsc` and the Vite build, and the Vitest run with the three permission cases, so a reviewer knows the Rust and TypeScript sides agree before they run the app.

Before merging, a reviewer runs `pnpm tauri dev` on their own machine, clicks the new button, grants permission and sees the notification; the `test-build.yml` workflow confirms the Linux bundle still builds. The macOS reviewer should test from a built bundle, because the system attributes the permission to the bundle identifier `com.tauri-app.my`.

## Run it on every Linear issue labelled desktop

A team that plans desktop work in Linear adds an automation with a `linear` trigger on `linear.issue.labeled` for the label `desktop`, the Project that has this repository, and this prompt. Labelling the issue that asks for notifications starts one run with the issue's text added after the prompt; the run does the work and opens a pull request that links back to the issue.

The trigger fills in no placeholder, so the same automation serves the next desktop issue, a tray icon or a global shortcut, as long as the issue says what the app should do.

## Why run it on Rush?

A Tauri plugin is three edits that must agree, a crate version, an npm version and a permission entry, plus frontend code that handles a permission the user may refuse. The agent reads the real `Cargo.lock`, `package.json` and the absence of a capabilities directory in its own sandbox, makes the edits together, and compiles both sides and runs the mocked flow before a reviewer opens the app.

The pull request says exactly what was verified and what was not, with the commands in the run's record, which is the honest shape for a change whose last step needs a desktop with a notification daemon.

## Frequently asked questions

### Why does the app need a capabilities file now?

Tauri 2 grants plugin commands to a window only through a capability. The template had none, so the frontend could not call the notification plugin at all. The new `default.json` grants `core:default`, the default permission of the shell plugin the app already registers, and `notification:default` to the `main` window, and nothing else.

### What if the user refuses permission?

The composable reports that nothing was sent and the Pinia flag stays false, so the app keeps working without notifications. The Vitest case for the denied path covers exactly this, and the component does not ask again until the user acts.

### Did the agent see a notification appear?

No, and the pull request says so. The sandbox has no desktop session with a notification daemon. It verified that the Rust crate compiles with the plugin, the TypeScript builds against the new package and the permission flow behaves under a mock; the reviewer's `pnpm tauri dev` is the visual check.

### Why mention the pnpm minimum release age?

The workspace refuses packages published in the last day, so a plugin release that is hours old resolves to the previous version. The pull request records the resolved version on both sides so the crate and the npm package are known to match.

### Does this work on macOS in development?

Permission on macOS is tied to the bundle identifier, `com.tauri-app.my`, so a built bundle is the reliable way to test; a dev build may show the prompt under a different identity. The pull request recommends testing the macOS path from `pnpm tauri build` output.

## More Tauri jobs

- [Persist User Settings in a Tauri App](https://getrush.ai/run/add-persistent-settings/tauri/)
- [Add a Single-Instance Lock to a Tauri App](https://getrush.ai/run/add-single-instance-lock/tauri/)
- [Add a System Tray Icon to a Tauri App](https://getrush.ai/run/add-tray-icon/tauri/)

## The same job on other stacks

- [Add Desktop Notifications to a Chrome Extension](https://getrush.ai/run/add-notifications/chrome-extension/)
- [Add Desktop Notifications to an Electron App](https://getrush.ai/run/add-notifications/electron/)

## More jobs like this: Turn a Linear label into a PR

- [Add Offline Support to a React Native App](https://getrush.ai/run/add-offline-support/react-native/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
