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:
enum WindowDirection: String, CaseIterable, Identifiable, Codable {
    var id: Self { self }
    // ... cases
}
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):
static var general: [WindowDirection]
static var halves: [WindowDirection]
static var quarters: [WindowDirection]
static var horizontalThirds: [WindowDirection]
static var verticalThirds: [WindowDirection]
static var horizontalFourths: [WindowDirection]
static var screenSwitching: [WindowDirection]
static var sizeAdjustment: [WindowDirection]
static var shrink: [WindowDirection]
static var grow: [WindowDirection]
static var move: [WindowDirection]
static var focus: [WindowDirection]
static var more: [WindowDirection]
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:
loop://[ActionRawValue]
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):
isNoOp
Bool
Returns true for .noSelection and .noAction
willChangeScreen
Bool
Returns true if the action moves the window to a different display
willAdjustSize
Bool
Returns true for size adjustment actions (larger, smaller, scaleUp, scaleDown)
willShrink
Bool
Returns true for shrink actions
willGrow
Bool
Returns true for grow actions
willMove
Bool
Returns true for move actions (moveUp, moveDown, etc.)
willFocusWindow
Bool
Returns true for focus actions
willCenter
Bool
Returns true for centering actions
isCustomizable
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:
var frameMultiplyValues: CGRect? {
    switch self {
    case .maximize: .init(x: 0, y: 0, width: 1.0, height: 1.0)
    case .leftHalf: .init(x: 0, y: 0, width: 1.0 / 2.0, height: 1.0)
    // ...
    }
}
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

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

Advanced Actions

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

Next Steps

Explore specific action categories:

General Actions

Halves & Quarters

Thirds & Fourths

Screen Switching

Size Adjustment

Focus Actions

Build docs developers (and LLMs) love