Skip to content

Shortcuts & Automation

The fn CLI works with any tool that can run shell commands: Apple Shortcuts, Raycast, Python, cron, and more.

Important: Always use the full path /usr/local/bin/fn in automation contexts — the PATH may not include it.


Apple Shortcuts

Quick Capture to Daily Note

Captures text (typed or dictated) and appends it to today's daily note with a timestamp.

  1. Ask for Input — Type: Text, Prompt: "What's on your mind?", variable: Capture
  2. Get Current Date — variable: Now
  3. Format Date — Date: Now, Format: Custom HH:mm, variable: Time
  4. Run Shell Script — Shell: /bin/zsh
    /usr/local/bin/fn daily append "**${Time}** — ${Capture}" --quiet
    
  5. Show Notification — Title: "Captured", Body: Capture

Variant: Replace step 1 with Dictate Text for hands-free voice capture.

Morning Brief — Today's Tasks

Shows overdue and due-today tasks as a formatted list.

  1. Run Shell Script — Shell: /bin/zsh
    OVERDUE=$(/usr/local/bin/fn tasks --overdue --json 2>/dev/null)
    TODAY=$(/usr/local/bin/fn tasks --due-today --json 2>/dev/null)
    
    echo "OVERDUE"
    echo "$OVERDUE" | /usr/bin/python3 -c "
    import sys, json
    tasks = json.load(sys.stdin)
    if not tasks: print('  None!')
    for t in tasks:
        note = t.get('noteTitle', '?')
        text = t.get('text', '')
        due = t.get('dateDue', '')[:10] if t.get('dateDue') else ''
        prefix = f'  [{due}]' if due else ' '
        print(f'{prefix} {text}  ({note})')
    "
    
    echo ""
    echo "DUE TODAY"
    echo "$TODAY" | /usr/bin/python3 -c "
    import sys, json
    tasks = json.load(sys.stdin)
    if not tasks: print('  None!')
    for t in tasks:
        note = t.get('noteTitle', '?')
        text = t.get('text', '')
        pri = t.get('priority', '')
        flag = ' !!' if pri == 'high' else ''
        print(f'  {text}{flag}  ({note})')
    "
    
  2. Choose from Menu — Prompt: script output, Options: "Open FoldNotes" → open "foldnotes://", "Done"

Variant: Set as Automation → Time of Day (e.g. 8:00 AM) for a daily morning prompt.

New Note from Share Sheet

Receives text from any app and creates a FoldNotes note.

Setup: Enable Show in Share Sheet, accept Text, URLs, Rich Text.

  1. Receive input from Share Sheet → variable: SharedText
  2. Ask for Input — Prompt: "Note title:", variable: Title
  3. If Title has value, use it. Otherwise, format current date as yyyy-MM-dd HH.mm for the title.
  4. Run Shell Script — Pass SharedText to stdin:
    /usr/local/bin/fn create "${Title}" --tag shared --quiet 2>&1
    
  5. Show Notification with result
  6. Choose from Menu — "Open in FoldNotes" → fn open "${Title}", "Done"

Python

import subprocess
import json

# List recent notes as JSON
result = subprocess.run(
    ["fn", "list", "--sort", "modified", "--limit", "10", "--json"],
    capture_output=True, text=True
)
notes = json.loads(result.stdout)

for note in notes:
    print(f"{note['title']}{note['modified']}")
# Create a note
subprocess.run([
    "fn", "create", "Weekly Review",
    "--content", "# Weekly Review\n\n## Wins\n\n## Challenges\n",
    "--tag", "review",
    "--quiet"
])
# Get overdue tasks
result = subprocess.run(
    ["fn", "tasks", "--overdue", "--json"],
    capture_output=True, text=True
)
tasks = json.loads(result.stdout)
print(f"{len(tasks)} overdue tasks")

Raycast

Create a Raycast Script Command (bash):

#!/bin/bash

# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Quick Capture
# @raycast.mode silent
# @raycast.argument1 { "type": "text", "placeholder": "Note text" }

/usr/local/bin/fn daily append "$1" --quiet
echo "Captured to daily note"

Tips

  • Keyboard shortcut: In System Settings → Keyboard → Shortcuts → Services, assign a hotkey to any Shortcut.
  • Menu bar: In Shortcut settings, enable "Pin in Menu Bar" for quick access.
  • Error handling: Add 2>&1 to capture stderr. Check $? for exit codes (0=success, 2=not found, 3=no collection).
  • JSON parsing: Use /usr/bin/python3 -c "import json..." or jq for JSON processing.