Skip to Content
Spiti

Use native plugin features

What happens when a plugin moves windows, types into other apps, reads your clipboard, listens for held keys or the microphone, or builds a native program.

Know what a native feature can do

Some plugins need more than a page or a card. Each of these is a permission you see at install and can revoke later in the plugin's settings. Each relies on macOS access that Spiti asks for once, the first time a plugin needs it. See Give Spiti macOS access.

PermissionWhat you'll noticemacOS access
Other apps' windowsThe plugin moves or resizes the focused window of another appAccessibility
Type into other appsText appears in the field you're typing in, right after you trigger the pluginAccessibility
Held keysHolding a key, such as fn or Right Option, starts something; releasing it stops itInput Monitoring
MicrophoneThe plugin hears you during a session it startsMicrophone
ClipboardThe plugin sees the text or image you copy, and copies things for you
Native programThe plugin builds a program at install for heavy work, such as speech to text

Type into other apps

A plugin with Type into other apps pastes its text into the app you're using and puts back what was on your clipboard. It can type only right after you do something: a shortcut, a held key, a command center command, or a button in a floating window, notification or menu bar item. A plugin running in the background can't type into your apps.

Hold a key

A plugin with Held keys learns only when you press and release the keys it listed, such as fn, Right ⌘, Right ⌥, Right ⌃ or Right ⇧. It never sees your other keystrokes.

macOS also uses the 🌐 fn key, for dictation, emoji or switching input sources. When a plugin uses fn, its section in Settings shows macOS also uses the 🌐 fn key. Choose Open Keyboard settings and set Press 🌐 key to to Do Nothing, so the plugin gets the key alone.

Let a plugin keep your clipboard

A plugin with Clipboard sees what you copy, text or images, while Spiti is open, and can put something back on the clipboard, as Clipboard History does. Items that password managers mark as concealed are never shared with plugins. Revoke the permission in the plugin's settings to stop it at once.

Know when a plugin listens

A plugin with Microphone hears audio only during a session it starts, for example while you hold its key. Spiti never saves the audio to disk.

While any plugin listens, Spiti's menu bar item turns into a microphone, and its menu says which plugin is listening. Choose Stop listening to end the session at once. macOS also shows its orange dot. Revoking the permission ends a session too.

Install a plugin with a native program

A plugin with a Native program builds it from its own source when you install or update it, inside the plugin's sandbox. The install screen shows which tools it builds with, such as Swift, and whether they're on your Mac. While it builds, it can reach only the plugin's own hosts and the tool's package hosts, which the install screen lists.

If the tools are missing, the install stops and tells you how to get them. For Swift, run xcode-select --install to install Xcode Command Line Tools, then install the plugin again. Rust and CMake show their own instructions.

For plugin authors

Declare native.windows, native.insertText, native.modifierTriggers (with keys from fn, rightCommand, rightOption, rightControl and rightShift) , native.microphone or native.clipboard under permissions, and a native program as "sidecar": { "build": "sidecar/build.sh", "toolchain": "swift" }, where toolchain is swift, rust or cmake. The build script writes its program to $SPITI_SIDECAR_OUTPUT/sidecar.

From server code:

  • ctx.native.windows.focused(), setFocused(frame) and screens()
  • ctx.native.insertText(text), which throws TriggerRequiredError outside a user trigger
  • ctx.native.microphone.start(), then read 16 kHz mono PCM from frames() and call stop()
  • ctx.native.clipboard.changeCount(), cheap enough to check each second; read() for { changeCount, content }, where content is { type: "text", text }, { type: "image", file, width, height, preview } or null; and write({ type: "text", text }) or write({ type: "image", file }). Images are PNG files in your data folder (file is relative to ctx.dataDirectory); preview is a small PNG data URL.
  • ctx.sidecar.spawn(args), which runs the program in your sandbox, talking over stdin and stdout

Map held keys to actions with definePlugin({ modifierTriggers: { rightOption: { press, release } } }). In views, useMicrophoneLevels() from @spiti/sdk/ui gives live levels for a waveform while your plugin's session is open.

On this page