Skip to main content

Introduction

The WindowDirection enum is the core of Loop’s window management system. It defines all possible window positioning, sizing, and management actions that can be triggered through:
  • URL scheme commands (loop://[action])
  • Keyboard shortcuts (keybinds)
  • The radial menu interface
  • Menubar actions

Enum Structure

WindowDirection is defined as a Swift enum in /Loop/Window Management/Window Action/WindowDirection.swift:12:
Each case represents a specific window action with a raw string value that’s used in URL schemes and configuration.

Action Categories

Loop organizes window actions into several logical categories:

General Actions

Fullscreen, maximize, center, minimize, and hide actions

Halves & Quarters

Split screen positioning in halves and quarters

Thirds & Fourths

Precise positioning in thirds and fourths

Screen Switching

Move windows between multiple displays

Size Adjustment

Grow, shrink, scale, and move windows

Focus Actions

Navigate between windows directionally

Static Arrays

For organization and UI purposes, WindowDirection defines static arrays grouping related actions (lines 75-87):
These arrays are used in:
  • The menubar resize submenu
  • Keybind configuration interfaces
  • Programmatic iteration over action groups

Using Actions

URL Scheme

Trigger any action using Loop’s URL scheme:
For example:
  • loop://Maximize - Maximize the frontmost window
  • loop://LeftHalf - Position window on left half
  • loop://TopRightQuarter - Position in top-right quarter

In Keybind Configuration

When setting up keyboard shortcuts, actions are referenced by their raw string values (e.g., “Maximize”, “LeftHalf”, “TopRightQuarter”).

Computed Properties

WindowDirection provides several utility properties for checking action characteristics (lines 90-107):
Bool
Returns true for .noSelection and .noAction
Bool
Returns true if the action moves the window to a different display
Bool
Returns true for size adjustment actions (larger, smaller, scaleUp, scaleDown)
Bool
Returns true for shrink actions
Bool
Returns true for grow actions
Bool
Returns true for move actions (moveUp, moveDown, etc.)
Bool
Returns true for focus actions
Bool
Returns true for centering actions
Bool
Returns true for custom and stash actions

Frame Calculations

Most positioning actions define frame multiply values (lines 109-147) that determine window position and size as fractions of the available screen space:
These values represent:
  • x: Horizontal offset from screen origin (0.0 to 1.0)
  • y: Vertical offset from screen origin (0.0 to 1.0)
  • width: Window width as fraction of screen width (0.0 to 1.0)
  • height: Window height as fraction of screen height (0.0 to 1.0)

Special Actions

No-Op Actions

WindowDirection
Explicitly chosen empty action - can be user-bound to disable a trigger
WindowDirection
Default state before any radial menu selection is made

Advanced Actions

WindowDirection
Restore window to its previous position and size
WindowDirection
Restore window to its original frame before any Loop actions
WindowDirection
User-defined custom positioning with configurable dimensions
WindowDirection
Cycle through a sequence of predefined window positions
WindowDirection
Temporarily hide window to a stash area
WindowDirection
Restore window from stash area

Next Steps

Explore specific action categories:

General Actions

Halves & Quarters

Thirds & Fourths

Screen Switching

Size Adjustment

Focus Actions