A tiling window manager for macOS, inspired by Aerospace and i3.
- Workspaces: Multiple virtual workspaces (1-9 by default)
- Tiling Layouts: BSP (Binary Space Partitioning) and Stack layouts
- Keyboard-Driven: Fully configurable keybindings
- Accessibility API: Uses native macOS Accessibility APIs
- Menu Bar App: System tray integration for easy control
- CLI Tool: Command-line interface for scripting and control
TilingWM/
├── Package.swift # Swift Package Manager manifest
├── Sources/
│ ├── TilingWM/ # Main application
│ │ └── AppDelegate.swift # Menu bar app entry point
│ ├── TilingWMCLI/ # CLI tool
│ │ └── main.swift # Command-line interface
│ └── TilingWMLib/ # Core library
│ ├── Window.swift # Window model
│ ├── Workspace.swift # Workspace model
│ ├── WorkspaceManager.swift # Workspace management
│ ├── WindowManager.swift # Window detection & management
│ ├── LayoutEngine.swift # Tiling layout calculations
│ ├── Config.swift # Configuration system
│ └── KeybindingManager.swift # Hotkey & command handling
└── Tests/
└── TilingWMTests/ # Unit tests
- macOS 13.0 or later
- Xcode 15.0 or later (or Swift 6.2+)
- Accessibility permissions (will be prompted on first run)
# Build the project
cd TilingWM
swift build
# Build for release
swift build -c release
# Run the main app
swift run TilingWM
# Run the CLI
swift run twm --help
# Run tests
swift test# Build release binaries
swift build -c release
# The binaries will be in .build/release/
# Copy to appropriate locations:
cp .build/release/TilingWM /Applications/TilingWM.app/Contents/MacOS/
cp .build/release/twm /usr/local/bin/Configuration file is located at ~/.config/tilingwm/config.toml
- Workspace Switching:
Cmd+Alt+1..9 - Move to Workspace:
Cmd+Alt+Shift+1..9 - Close Window:
Cmd+Alt+Q - Toggle Float:
Cmd+Alt+F - Focus Direction:
Cmd+Alt+H/J/K/L - Move Window:
Cmd+Alt+Shift+H/J/K/L - Resize:
Cmd+Alt+Minus/Equal - Layout Mode:
Cmd+Alt+B/S(BSP/Stack)
[general]
startAtLogin = false
enableAnimations = false
defaultLayout = "bsp"
[gaps]
inner = 10
outer = 10
[[workspaces]]
id = "1"
name = "Terminal"
layout = "bsp"
[[workspaces]]
id = "2"
name = "Browser"
layout = "bsp"
[[keybindings]]
key = "1"
modifiers = ["cmd", "alt"]
command = "workspace"
args = ["1"]
[[rules]]
app = "System Settings"
float = true
[[rules]]
app = "Safari"
workspace = "2"# Workspace commands
twm workspace switch 1 # Switch to workspace 1
twm workspace list # List all workspaces
# Window commands
twm window close # Close focused window
twm window focus left # Focus window to the left
twm window move right # Move window to the right
# Layout commands
twm layout set bsp # Set BSP layout
twm layout set stack # Set Stack layout
# Configuration
twm config edit # Open config in editor
twm config reload # Reload configuration
# Service management
twm service start # Start TilingWM
twm service stop # Stop TilingWM
twm service restart # Restart TilingWM
twm service status # Check status- WindowManager: Uses macOS Accessibility API to track and manage windows
- WorkspaceManager: Manages virtual workspaces and window assignments
- LayoutEngine: Calculates window positions for tiling layouts
- KeybindingManager: Registers global hotkeys using Carbon Event Manager
- CommandHandler: Executes commands from keybindings or CLI
- ConfigManager: Loads and manages TOML configuration
The window manager uses the Accessibility API (AXUIElement) to:
- Detect window creation/destruction
- Track window positions and sizes
- Move and resize windows
- Focus windows
- Each workspace maintains a list of windows
- Windows are hidden by moving off-screen when switching workspaces
- Active workspace windows are laid out according to the current layout mode
BSP (Binary Space Partitioning):
- Recursively splits space between windows
- Alternates between horizontal and vertical splits based on aspect ratio
Stack:
- Main window takes 60% of space
- Remaining windows stacked on the side
- Open the project in Xcode
- Set the scheme to
TilingWM - Build and run (⌘R)
The app requires Accessibility permissions to control windows:
- Open System Settings → Privacy & Security → Accessibility
- Add and enable
TilingWM.app
This implementation provides a simpler foundation:
- Uses Swift + AppKit instead of being fully scriptable
- Simpler configuration format
- Smaller feature set (can be extended)
- No tree-based layout preservation yet
- No built-in workspace previews
- IPC communication for CLI
- Tree-based layout preservation
- Workspace previews
- Multi-monitor support improvements
- Application-specific rules
- Gaps customization per workspace
- Animations
- Mission Control integration
- Window decorations
MIT License
Contributions are welcome! Please feel free to submit issues or pull requests.