Introduction
TheWindowDirection 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:
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):- The menubar resize submenu
- Keybind configuration interfaces
- Programmatic iteration over action groups
Using Actions
URL Scheme
Trigger any action using Loop’s URL scheme:loop://Maximize- Maximize the frontmost windowloop://LeftHalf- Position window on left halfloop://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):Returns true for
.noSelection and .noActionReturns true if the action moves the window to a different display
Returns true for size adjustment actions (larger, smaller, scaleUp, scaleDown)
Returns true for shrink actions
Returns true for grow actions
Returns true for move actions (moveUp, moveDown, etc.)
Returns true for focus actions
Returns true for centering actions
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:- 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
Explicitly chosen empty action - can be user-bound to disable a trigger
Default state before any radial menu selection is made
Advanced Actions
Restore window to its previous position and size
Restore window to its original frame before any Loop actions
User-defined custom positioning with configurable dimensions
Cycle through a sequence of predefined window positions
Temporarily hide window to a stash area
Restore window from stash area