Move and resize windows on macOS with keyboard shortcuts and snap areas
Rectangle is a window management app based on Spectacle, written in Swift.
Rectangle supports macOS v10.15+. The last version that is supported for macOS 10.13 and 10.14 is https://github.com/rxhanson/Rectangle/releases/tag/v0.73.
You can download the latest dmg from https://rectangleapp.com or the Releases page.
Or install with brew cask:
brew install --cask rectangle
The keyboard shortcuts are self explanatory, but the snap areas can use some explanation if you’ve never used them on Windows or other window management apps.
Drag a window to the edge of the screen. When the mouse cursor reaches the edge of the screen, you’ll see a footprint that Rectangle will attempt to resize and move the window to when the click is released.
Snap Area | Resulting Action |
---|---|
Left or right edge | Left or right half |
Top | Maximize |
Corners | Quarter in respective corner |
Left or right edge, just above or below a corner | Top or bottom half |
Bottom left, center, or right third | Respective third |
Bottom left or right third, then drag to bottom center | First or last two thirds, respectively |
Open the URL rectangle://execute-action?name=[name]
. Do not activate Rectangle if possible.
Available values for [name]
: left-half
, right-half
, center-half
, top-half
, bottom-half
, top-left
, top-right
, bottom-left
, bottom-right
, first-third
, center-third
, last-third
, first-two-thirds
, last-two-thirds
, maximize
, almost-maximize
, maximize-height
, smaller
, larger
, center
, center-prominently
, restore
, next-display
, previous-display
, move-left
, move-right
, move-up
, move-down
, first-fourth
, second-fourth
, third-fourth
, last-fourth
, first-three-fourths
, last-three-fourths
, top-left-sixth
, top-center-sixth
, top-right-sixth
, bottom-left-sixth
, bottom-center-sixth
, bottom-right-sixth
, specified
, reverse-all
, top-left-ninth
, top-center-ninth
, top-right-ninth
, middle-left-ninth
, middle-center-ninth
, middle-right-ninth
, bottom-left-ninth
, bottom-center-ninth
, bottom-right-ninth
, top-left-third
, top-right-third
, bottom-left-third
, bottom-right-third
, top-left-eighth
, top-center-left-eighth
, top-center-right-eighth
, top-right-eighth
, bottom-left-eighth
, bottom-center-left-eighth
, bottom-center-right-eighth
, bottom-right-eighth
, tile-all
, cascade-all
, cascade-active-app
Example, from a shell: open -g "rectangle://execute-action?name=left-half"
URLs can also be used to ignore/unignore apps.
rectangle://execute-task?name=ignore-app
rectangle://execute-task?name=unignore-app
A bundle identifier can also be specified, for example:
rectangle://execute-task?name=ignore-app&app-bundle-id=com.apple.Safari
Apple never released a public API for doing this. Rectangle Pro has next/prev Space actions, but there are no plans to add those into Rectangle at this time.
By default iTerm2 will only resize in increments of character widths. There might be a setting inside iTerm2 to disable this, but you can change it with the following command.
defaults write com.googlecode.iterm2 DisableWindowSizeSnap -integer 1
This appears to affect only a small amount of users. To prevent this from happening, uncheck the box for “Snap windows by dragging”.
See issue 317.
If windows aren’t resizing or moving as you expect, here’s some initial steps to get to the bottom of it. Most issues of this type have been caused by other apps.
tccutil reset All com.knollsoft.Rectangle
Or, this can be done with the following steps instead of the tccutil terminal command.
There are buttons for importing and exporting the config as a JSON file in the settings tab of the preferences window.
Upon launch, Rectangle will load a config file at ~/Library/Application Support/Rectangle/RectangleConfig.json
if it is present and will rename that file with a time/date stamp so that it isn’t read on subsequent launches.
The configuration for Rectangle is stored using NSUserDefaults, meaning it is stored in the following location:
~/Library/Preferences/com.knollsoft.Rectangle.plist
Note that shortcuts in v0.41+ are stored in a different format and will not load in prior versions.
That file can be backed up or transferred to other machines.
If you are using Rectangle v0.44+, you can also use the import/export button in the Preferences pane to share to your preferences and keyboard shortcuts across machines using a JSON file.
[!NOTE]
If you are having issues with configuration options persisting after an application restart and you’ve installed using Homebrew, you will need to uninstall and reinstall with the--zap
flag.
brew uninstall --zap rectangle
brew install rectangle
Rectangle can be uninstalled by quitting the app and moving it to the trash. You can remove the Rectangle defaults from your machine with the following terminal command:
defaults delete com.knollsoft.Rectangle
[!TIP]
If you are uninstalling after installing with Homebrew, you should include the--zap
flag to ensure it removes the plist entries too.
brew uninstall --zap rectangle
Logic from Rectangle is used in the Multitouch app. The Rectangle Pro app is entirely built on top of Rectangle. If you contribute significant code or localizations that get merged into Rectangle, send me an email for a free license of Multitouch or Rectangle Pro. Contributors to Sparkle, MASShortcut, or Spectacle can also receive free Multitouch or Rectangle Pro licenses.
If you would like to contribute to localization, all of the translations are held in the Main.strings per language. If you would like to add a localization but one doesn’t currently exist and you don’t know how to create one, create an issue and a translation file can be initialized.
Pull requests for new localizations or improvements on existing localizations are welcome.
Rectangle uses Swift Package Manager to install Sparkle and MASShortcut.
The original repository for MASShortcut was archived, so Rectangle uses my fork. If you want to make any changes that involve MASShortcut, please make a pull request on my fork.