Skip to main content

Overview

Loop supports URL scheme commands for window management and automation. All commands use the base format:
All commands are case-insensitive and operate on the frontmost non-terminal window.

Base URL Format

string
required
Must be loop
string
required
The command type: direction, screen, action, keybind, or list
string
Command-specific parameters (varies by command type)

Direction Commands

Move or resize windows using directional commands.

Endpoint

Parameters

string
required
The direction to move or resize the window. Supports both short and full names.Basic directions:
  • left - Move window to left half
  • right - Move window to right half
  • top - Move window to top half
  • bottom - Move window to bottom half
  • maximize - Maximize window
  • center - Center window
Full names: Any value from WindowDirection enum (e.g., leftHalf, rightHalf, topHalf, bottomHalf)

Examples

Response

void
Window is moved/resized to the specified direction. No return value.

Error Responses

string
Returns error message to console/log:
  • "No direction specified" - Missing direction parameter
  • "Invalid direction: <value>" - Unknown direction value
  • "No suitable windows or screen found" - No eligible window to operate on

Screen Commands

Move windows between multiple displays.

Endpoint

Parameters

string
required
Screen movement command:
  • next - Move window to next screen
  • previous - Move window to previous screen

Examples

Response

void
Window is moved to the target screen. No return value.

Error Responses

string
Returns error message to console/log:
  • "No screen command or window" - Missing parameter or no active window
  • "Failed to find target screen" - No available screen in requested direction

Action Commands

Execute predefined window actions or custom actions.

Endpoint

Parameters

string
required
The action to execute. Can be:Predefined actions:
  • Any WindowDirection value (e.g., maximize, leftHalf, rightHalf)
  • See loop://list/actions for complete list
Custom actions:
  • Any custom action name you’ve defined in Loop settings
  • Custom action names are case-insensitive
Stash actions:
  • Any stash action name you’ve defined

Examples

Response

void
Action is executed on the target window. No return value.
file
When using loop://action/list, opens a temporary text file with categorized actions:
  • Custom Actions
  • Stash Actions
  • General Actions
  • Halves
  • Quarters
  • Horizontal Thirds
  • Vertical Thirds
  • Screen Switching
  • Size Adjustment
  • Shrink
  • Grow
  • Move
  • Other

Error Responses

string
Returns error message to console/log:
  • "Invalid action: <value>" - Unknown action name
  • "Could not find a suitable window to apply the custom action" - No eligible window

Keybind Commands

Execute custom keybind actions by name.

Endpoint

Parameters

string
required
The name of the custom keybind to execute. Must match a keybind name defined in Loop settings.
  • Names are case-insensitive
  • Use loop://keybind/list or loop://list/keybinds to see available keybinds

Examples

Response

void
Keybind is executed on the target window. No return value.
array
When using loop://keybind/list, prints available keybind names to console.

Error Responses

string
Returns error message to console/log:
  • "No keybind specified" - Missing name parameter
  • "Keybind not found: <name>" - No keybind with that name exists

List Commands

View available commands, actions, and keybinds.

Endpoint

Parameters

string
default:"all"
The type of items to list:
  • actions - List all window actions (predefined and custom)
  • keybinds - List all custom keybinds
  • all - List all commands, actions, and keybinds

Examples

Response

file
Opens a temporary text file (auto-deleted after 60 seconds) containing:
For loop://list/actions:
  • Custom Actions (if any defined)
  • Stash Actions (if any defined)
  • General Actions
  • Halves (leftHalf, rightHalf, topHalf, bottomHalf)
  • Quarters (topLeft, topRight, bottomLeft, bottomRight)
  • Horizontal Thirds
  • Vertical Thirds
  • Screen Switching (nextScreen, previousScreen)
  • Size Adjustment
  • Shrink
  • Grow
  • Move
  • Other
For loop://list/keybinds:
  • All named custom keybinds with their URL format
For loop://list/all:
  • All direction commands
  • All screen commands
  • All actions (custom and predefined)
  • All keybind commands
  • All list commands

Error Handling

Invalid Scheme

If the URL scheme is not loop://, returns:

Invalid Command

If the command is not recognized, returns:

Missing Parameters

Each command type provides specific guidance when parameters are missing. For example:

Window Selection

Loop automatically selects the target window using this priority:
  1. User-defined target - Window selected via Loop’s target window mechanism
  2. Last active window - Window that was active within the last 5 seconds
  3. Frontmost window - First eligible window in the window list

Eligible Windows

Windows must meet these criteria:
  • Not the Loop application itself
  • Regular activation policy (not background-only apps)
  • Visible (not hidden or minimized)

Usage Tips

  • All commands are case-insensitive
  • Parameters with spaces must be URL-encoded
  • Use list commands to discover available options dynamically
  • Commands can be executed from Terminal, AppleScript, or any automation tool
Window commands operate on the frontmost non-terminal window. Ensure the target window is active before executing commands for predictable results.

Integration Examples

Shell Script

Keyboard Maestro

Alfred Workflow

Hammerspoon


Command Reference Table