Skip to content

superlowburn/tokoro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tokoro

Tokoro (所) — Japanese for "place." Everything in its place.

A free, open-source macOS menu bar app that saves and restores window layouts.

Save your window positions, sizes, and arrangement across apps and Spaces as named profiles ("Work", "Meetings", "Relax"), then restore them with a click or a keyboard shortcut.

Features

  • Save window layouts as named profiles
  • Restore layouts instantly — windows snap back to saved positions and sizes
  • Multi-display support — tracks which display each window belongs to
  • Multi-Space support — moves windows between Spaces using private CGS APIs
  • App lifecycle management — launches and hides apps on profile switch
  • Global keyboard shortcuts — assign hotkeys to profiles for instant switching
  • Menu bar only — no Dock icon, lives in the menu bar
  • Zero external dependencies — pure Swift, AppKit, SwiftUI
  • JSON persistence — profiles stored in ~/Library/Application Support/Tokoro/

Install

Download

Grab the latest DMG from Releases, open it, and drag Tokoro to Applications.

Build from source

git clone https://github.com/superlowburn/tokoro.git
cd tokoro
./build.sh
open build/Tokoro.app

Requires macOS 13+ and Swift 5.9+ (Xcode Command Line Tools).

Usage

  1. Grant Accessibility permission when prompted on first launch (required to read/set window positions)
  2. Click the rectangles icon in the menu bar
  3. Click Save Layout to save your current window arrangement
  4. Rearrange windows however you want
  5. Click a saved profile to restore that layout
  6. Double-click a profile row to restore, or use the ... menu for edit/update/delete

Keyboard shortcuts

Open a profile's editor to record a global keyboard shortcut. Press any modifier+key combo (e.g., Ctrl+Opt+1) to assign it.

How it works

  • Window capture: CGWindowListCopyWindowInfo enumerates all windows, AXUIElement reads precise positions
  • Window restore: AXUIElement sets kAXPositionAttribute and kAXSizeAttribute
  • Space detection: Private CGSCopyManagedDisplaySpaces and CGSCopySpacesForWindows APIs
  • Space movement: Private CGSAddWindowsToSpaces / CGSRemoveWindowsFromSpaces APIs
  • App launch: NSWorkspace.shared.openApplication(at:configuration:)
  • Global hotkeys: Carbon RegisterEventHotKey API

Private APIs

Tokoro uses private CoreGraphics SPI (CGSBridge.swift) for Space-related features. These APIs are not guaranteed by Apple and may break in future macOS versions. All private API usage is isolated in a single file for easy maintenance.

License

MIT — free to use, modify, and distribute.

About

Tokoro (所) — free macOS menu bar app that saves and restores window layouts. Everything in its place.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors