Terminal Buttons

unlisted

by Tomáš Starenko

An embedded terminal with configurable macro buttons — define buttons that type keystroke sequences (launch a CLI, wait, run a command) into a persistent shell.

Updated 2mo agoMIT
View on GitHub

Terminal Buttons — Obsidian plugin

An embedded terminal in Obsidian with configurable macro buttons. The panel runs a persistent shell (PowerShell by default) you can type into like any terminal, plus a toolbar of buttons you define. Each button plays a macro — a keystroke sequence — into the running shell. A button can run git status<enter>; another can launch a long-running command, wait, and send a follow-up keystroke.

Desktop only. Windows-focused (uses winpty); the build is generic.

Concepts

Persistent shell

On open the plugin spawns the configured shell (default pwsh) in an xterm.js terminal (WebGL renderer). Configure command / args / cwd / env in settings.

Macro buttons

Each button has a label and a macro. Macro syntax:

TokenEffect
literal texttyped as-is
<enter> / <cr>Enter
<wait:300> (<wait 300>, <wait+300>)pause N ms
<tab> <esc> <space> <bs>those keys
<up> <down> <left> <right>arrows
<ctrl-c> (<ctrl-X>)control char
<<literal <
{file} {path} {selection} {vaultPath}active-note vars

Example: npm run dev<enter><wait:1500><ctrl-c> — start a dev server, wait for it to boot, then send Ctrl-C. Or git status<enter> for a one-shot command.

Toolbar

[Clear] [Restart] [Kill] + one button per configured shortcut. Clear wipes the buffer, Restart relaunches the shell, Kill stops the process.

Build

npm install
npm run build   # tsc typecheck + esbuild -> main.js, styles.css

Native terminal (node-pty)

The terminal needs a node-pty binary matching Obsidian's Electron ABI (find it via Ctrl+Shift+I → process.versions.modules). Prebuilt binaries lag new Electron, so compile:

Prereqs: Node, VS with Desktop development with C++ (MSVC + Windows SDK), Python 3, and npm i -D node-gyp@latest (≥ 12.1 for VS 2026 / toolset v145).

pwsh -File scripts/rebuild-pty.ps1 -ElectronVersion 39.8.3

It compiles @homebridge/node-pty-prebuilt-multiarch against the Electron headers and works around winpty's commit-hash bats and the SpectreMitigation flag. It also overlays patches/windowsConoutConnection.js, which drops node-pty's worker_threads.Worker (the Electron renderer cannot create Workers) and connects the conout pipe directly (safe under winpty, which this plugin forces via useConpty:false).

Deploy

pwsh -File scripts/deploy.ps1 -VaultPlugins "C:\path\to\vault\.obsidian\plugins"
# or set $env:OBSIDIAN_PLUGINS_DIR once and run: pwsh -File scripts/deploy.ps1

Copies main.js, manifest.json, styles.css and the node-pty payload into <vault>/.obsidian/plugins/terminal-buttons/. Reload Obsidian and enable the plugin.

Notes

  • Buttons type into the running shell (no per-button process spawn), so a macro like git status<enter> relies on the shell (pwsh) resolving git from PATH.
  • Security: macros and the shell run with your environment. Only configure commands you'd run in a terminal yourself.

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.