Actions

Actions

Run your own scripts with Glimpse. An action is one file in the Actions folder. Press its shortcut, or start a dictation with its phrase, and Glimpse runs it with what you said. Whatever it prints shows as a notice or is typed where you are.

Write it in any language: Python, JavaScript, a shell script, PowerShell.

  • Say "translate into Spanish, where is the station" and the Spanish is typed.
  • Hold a key, ask a question, and get the answer as a notice.
  • After every dictation, add it to today's journal.
Have Claude Code or Codex build one for you.

One file

The lines at the top say when it runs and what happens to its output. The rest is your script, which reads what you said from standard input.

Translate.py
#!/usr/bin/env python3
# @glimpse.description Say "translate into" and a language, then what to translate. Types the result.
# @glimpse.say translate into
# @glimpse.show insert
import subprocess, sys

spoken = sys.stdin.read().strip()
language, _, text = spoken.partition(",")
if not text:
    language, _, text = spoken.partition(" ")
language, text = language.strip(" .:"), text.strip()
if not text:
    sys.exit("Say a language, then what to translate.")

reply = subprocess.run(
    ["glimpse", "llm", f"Translate the text into {language}. Reply with only the translation, without naming the language.", "--local"],
    input=text, capture_output=True, text=True,
)
if reply.returncode:
    sys.exit(reply.stderr.strip() or "Translation failed")
print(reply.stdout.strip())

Actions need a Glimpse license or the trial.