HookAnchor - USER GUIDE

HookAnchor User Guide

HookAnchor is a powerful command launcher for macOS that provides instant access to applications, files, URLs, and custom commands through a keyboard-driven popup interface.

Table of Contents

  1. Installation
  2. Getting Started
  3. Basic Usage
  4. Key Features
  5. Command Types
  6. Keyboard Shortcuts
  7. Creating Commands
  8. Tips and Tricks
  9. Troubleshooting

Installation

Requirements

Installation Steps

  1. Download HookAnchor

  2. Install the Application

  3. First Launch - Bypass macOS Security

    Because HookAnchor is not signed with an Apple Developer certificate, macOS will block it on first launch. Follow these steps:

    1. Try to open HookAnchor.app from Applications (double-click)
      • You’ll see: “HookAnchor cannot be opened” with “Move to Trash” option
      • Click “Done” or “Cancel”
    2. Open System Settings:
      • Go to System Settings (or System Preferences)
      • Select Privacy & Security
      • Scroll down to the Security section
      • You should see: “HookAnchor.app was blocked from use because it is not from an identified developer”
    3. Approve the app:
      • Click “Open Anyway”
      • Try opening HookAnchor.app again
      • In the new dialog, click “Open”

    Important Notes:

  4. Grant Permissions: Allow accessibility permissions when prompted

  5. You’re Done!: Press Option+Space (⌥Space) from anywhere to open HookAnchor

  6. Setup Keyboard Trigger (choose one method below - Option 1 is recommended)

Setting Up Keyboard Triggers

You can trigger HookAnchor using any of these methods:

Option 1: Built-in Global Hotkey (Simplest - No Setup Required!)

HookAnchor includes a native global hotkey system that works out of the box!

By default, HookAnchor uses Option+Space (⌥Space) to show the popup from any application.

To change the hotkey:

  1. Open the configuration file:

    open ~/.config/hookanchor/config.yaml
  2. Find the global_hotkey line (around line 21):

    global_hotkey: "Option+Space"
  3. Change it to your preferred key combination:

    global_hotkey: "Option+`"          # Option+Backtick
    global_hotkey: "Command+Shift+Space"  # Cmd+Shift+Space
    global_hotkey: "Control+Space"     # Control+Space
  4. Save the file and restart HookAnchor

Supported keys: - Modifiers: Option, Command, Control, Shift - Keys: Space, Return, Enter, , Backtick - **Format**: Use+` to combine (e.g., “Option+Space”, “Command+Shift+Return”)

Advantages: - ✅ Works from any application system-wide - ✅ No third-party software needed - ✅ No system settings to configure - ✅ Just works!

Option 2: Keyboard Maestro (Power Users)

If you use Keyboard Maestro:

  1. Create a new macro
  2. Set trigger to your desired key (e.g., Caps Lock, F13, or any combo)
  3. Add action: Open a File, Folder or Application
  4. Select: /Applications/HookAnchor.app
  5. Enable “Reopen” option for instant triggering

Option 3: Karabiner-Elements (Caps Lock)

For using Caps Lock as trigger:

  1. Download Karabiner-Elements

  2. Install and grant permissions

  3. Add this rule to use Caps Lock:

    {
      "description": "Caps Lock opens HookAnchor",
      "manipulators": [{
        "type": "basic",
        "from": { "key_code": "caps_lock" },
        "to": [{ "shell_command": "open /Applications/HookAnchor.app" }]
      }]
    }

Option 4: Other Automation Tools

HookAnchor works with any tool that can launch applications: - BetterTouchTool: Assign to gestures or keys - Alfred: Create a workflow to launch HookAnchor - Raycast: Add as a script command - Hammerspoon: Configure in Lua script

Getting Started

Triggering HookAnchor

Once you’ve set up your keyboard trigger, press your chosen key combination to open the HookAnchor popup. The popup displays a searchable list of all your commands.

Basic Navigation

Basic Usage

Searching Commands

  1. Press your configured trigger key to open HookAnchor
  2. Start typing part of a command name
  3. Matching commands appear instantly
  4. Use arrow keys to select
  5. Press Enter to execute

Command Organization

Commands are organized into patches (groups). When you see a command like:

Work > Project Setup

This means “Project Setup” is in the “Work” patch.

Similar commands are automatically grouped into submenus. For example:

Git >

Pressing Enter on this opens a submenu with all Git-related commands.

Key Features

1. Universal Command Launcher

Launch anything from one place: - Applications - Websites - Folders - Shell commands - Custom scripts

3. Markdown Integration

HookAnchor scans configured folders for markdown files and creates commands from: - Anchor files (markdown files matching folder names) - Code blocks in markdown - Links in markdown files

4. URL Scheme Support

Use hook:// URLs from anywhere:

open "hook://terminal"    # Opens Terminal
open "hook://slack"       # Opens Slack

5. Context Grabber

Capture context from any application: 1. Press + in the popup 2. Enter a name for the command 3. Wait for countdown 4. Click on any window/application 5. HookAnchor creates a command for it

Command Types

Type Description Example
app Launch macOS applications Terminal : app Terminal
Chrome : app Google Chrome
url Open websites in default browser GitHub : url https://github.com
Google : url https://google.com
folder Open folders in Finder Downloads : folder ~/Downloads
Projects : folder ~/Documents/Projects
cmd Execute shell commands List Files : cmd ls -la
Server : cmd npm run dev
anchor Navigate to project folders with markdown files My Project : anchor ~/Projects/MyProject/MyProject.md
alias Reference other commands Term : alias Terminal
GH : alias GitHub

Keyboard Shortcuts

Key Action
Escape Close popup
Enter Execute command
Arrow Keys Navigate commands
/ Launch first folder matching search
= Template: Edit command from current input
; Template: Edit currently selected command
+ Template (Grab): Capture window/app after countdown
> Template (Alias): Create alias to last executed command
! Template (Sub Anchor): Create anchor as subfolder of last executed
& Template (Sub Markdown): Create markdown note in same folder as last executed
` Show history viewer
? Show keyboard shortcuts
Cmd+Shift+H Open User Guide (HTML documentation)

Creating Commands

Method 1: Using Templates

  1. Open HookAnchor (your configured trigger key)
  2. Press a template key (e.g., % for anchor)
  3. Enter the command name
  4. Edit details if needed
  5. Save the command

Method 2: Using the Grabber

  1. Open HookAnchor
  2. Press +
  3. Enter a name
  4. Wait for countdown
  5. Click the target window
  6. Command is created automatically

Method 3: Markdown Files

Create commands in markdown files within your configured markdown_roots:

# My Commands

Terminal : app Terminal
Chrome : app Google Chrome
GitHub : url https://github.com

Method 4: Direct Configuration

Edit ~/.config/hookanchor/config.yaml to add custom functions and templates.

Tips and Tricks

Quick Access Patterns

  1. Two-letter shortcuts: Name frequently used commands with 2-3 letters
  2. Patch prefixes: Use consistent prefixes for groups
  3. Smart naming: Use descriptive but searchable names

Workflow Integration

  1. Project Anchors: Create anchor commands for each project
  2. URL Shortcuts: Create shortcuts for frequently visited sites
  3. Script Launchers: Turn complex scripts into simple commands

Troubleshooting

  1. Verify your keyboard trigger is properly configured:

  2. Test launching manually:

    open /Applications/HookAnchor.app
  3. Check HookAnchor process is running:

    ps aux | grep HookAnchor
  4. Check logs for errors:

    tail -f ~/.config/hookanchor/anchor.log

Commands Not Found

  1. Check markdown_roots configuration

  2. Force rescan with ` key

  3. Verify file permissions

  4. Check scanner is finding files:

    ha --rescan

URL Handling Issues

Performance Issues

  1. Reduce max_rows in configuration
  2. Disable merge_similar if not needed
  3. Increase scan_interval_seconds
  4. Check log file size (auto-rotates at 10MB)

Reset Configuration

To start fresh with default configuration:

# Backup current config, then remove it to regenerate defaults
cp ~/.config/hookanchor/config.yaml ~/.config/hookanchor/config.backup.yaml && rm ~/.config/hookanchor/config.yaml
# Restart HookAnchor to load defaults

Restore from Backup

To restore commands from a previous backup:

# Copy an earlier version of commands.txt from backups folder
# This will load previous commands over the existing commands
cp ~/.config/hookanchor/backups/commands_YYYYMMDD_HHMMSS.txt ~/.config/hookanchor/commands.txt

# Or restore the cache file to replace current commands with earlier version
cp ~/.config/hookanchor/backups/cache_YYYYMMDD_HHMMSS.json ~/.config/hookanchor/commands_cache.json

Both files in the backups folder use matching timestamps, so you can restore both from the same point in time.

Getting Help

Use the CLI help system for detailed information:

ha --help              # General help and command overview
ha --help-config       # Configuration reference
ha --help-templates    # Templates and scripting guide

Additional resources: - Logs: Check ~/.config/hookanchor/anchor.log for debugging - Issues: Report bugs at https://github.com/oblinger/hookanchor/issues

Action Reference

Action types specify what kind of command to execute. These are used in command definitions to tell HookAnchor how to handle the command.

Action Type Description Example
app Launch macOS applications Terminal : app Terminal
url Open websites in default browser GitHub : url https://github.com
folder Open folders in Finder Downloads : folder ~/Downloads
cmd Execute shell commands List : cmd ls -la
anchor Navigate to project folders with markdown files Project : anchor ~/Project/Project.md
alias Reference other commands GH : alias GitHub
markdown Open markdown files in Obsidian Notes : markdown ~/Documents/notes.md
doc Open document files (Word, Excel, etc.) Report : doc ~/Documents/report.docx
chrome Open URL in Chrome Gmail : chrome https://mail.google.com
safari Open URL in Safari News : safari https://news.ycombinator.com
brave Open URL in Brave browser Web3 : brave https://ethereum.org
notion Open Notion pages Tasks : notion https://notion.so/tasks
slack Open Slack channels Team : slack https://team.slack.com/archives/...
contact Open contact cards John : contact john@example.com
text Open text files Todo : text ~/Documents/todo.txt
console Open Google Cloud Console GCP : console https://console.cloud.google.com
obs_url Open Obsidian URLs Daily : obs_url obsidian://open?vault=MyVault