Actions

unlisted

by @mcmanussliam

Create and manage custom `shell` or `js` actions that can run on either a schedule, via command palette, or in response to file events.

4 starsUpdated 1mo ago0BSD
View on GitHub

Obsidian Code View Banner

Obsidian

Obsidian Actions

Obsidian Actions is a lightweight Obsidian plugin for small automations. Each action has three parts:

  • a trigger
  • an execution type
  • a code body

Use it to run commands, call scripts, show notices, or respond to Obsidian events without building a full plugin. See documentation here.

Install

Community Plugin

Since this plugin isn't officially released in the Community Plugins store yet, the easiest way to install it is with Obsidian BRAT, which lets you install plugins directly from GitHub.

After BRAT is enabled:

Manual Install

Copy the plugin files into:

<vault>/.obsidian/plugins/actions

Required files:

  • main.js
  • styles.css
  • manifest.json

Quick Start

  1. Open Settings -> Actions.
  2. Create a new action.
  3. Choose a trigger.
  4. Choose js or shell.
  5. Write the code.
  6. Restart Obsidian to register commands and hooks.

Start with a manual JavaScript action:

new Notice("Action ran");

Suggested fields:

  • hook: manual
  • type: js
  • enabled: true

Triggers

HookBehavior
manualRuns when you trigger it from Obsidian
startupRuns when the plugin loads
intervalRuns on a cron schedule
createFileRuns when a file is created
modifyFileRuns when a file is modified
deleteFileRuns when a file is deleted
renameFileRuns when a file is renamed

Execution Types

TypeUse It For
jsObsidian-aware automations that need app APIs, notices, or editor context
shellExisting scripts, CLI tools, or system workflows

Available JavaScript helpers include:

  • app
  • vault
  • workspace
  • metadataCache
  • fileManager
  • Notice
  • Modal
  • Setting
  • FuzzySuggestModal
  • exec

Runtime Variables

Before an action runs, the plugin renders its code with Mustache templates such as {{file_name}} or {{path}}.

Available variables include:

  • path
  • relative_path
  • extension
  • selected
  • word_count
  • vault_name
  • file_name
  • file_name_with_ext
  • content
  • timestamp
  • date
  • time

Example:

echo "Processing {{{file_name_with_ext}}} at {{time}}"

Compatibility

TypeDesktopMobile
jsSupportedDepends on the APIs and code you use
shellSupported where Obsidian can execute local shell commandsNot reliable on mobile

shell actions are best suited to desktop environments with access to local scripts, binaries, and a usable shell environment.

Examples

Open the current file in VS Code:

/path/to/code "{{{path}}}"

Show the current file in a notice:

new Notice(`Current file: {{{file_name_with_ext}}}`);

Run a backup script on a schedule:

/absolute/path/to/backup-vault.sh

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.