Contents
How to bind a command with no interface
Every hidden command is bound the same way: write a dictionary containing a keycode and a modifier value into the preference domain, then restart the app.
defaults write com.knollsoft.Rectangle COMMAND_NAME -dict-add keyCode -float KEY modifierFlags -float MODS
killall Rectangle && open -a Rectangle
Modifier values are summed:
| Modifier | Value |
|---|---|
| Command | 1048576 |
| Option | 524288 |
| Control | 262144 |
| Shift | 131072 |
| Fn | 8388608 |
| Combination | Sum |
|---|---|
| Control + Option | 786432 |
| Control + Option + Shift | 917504 |
| Control + Option + Command | 1835008 |
| Control + Option + Command + Shift | 1966080 |
Keycodes for the number and letter rows are in the keycodes reference. The values used repeatedly below: <code>18</code> is the 1 key, <code>19</code> is 2, <code>20</code> is 3, <code>8</code> is C, <code>30</code> is ], <code>33</code> is [, and <code>123</code>–<code>126</code> are the arrow keys.
Ninths: a 3×3 grid
Nine commands dividing the screen into a three-by-three grid. On a 32-inch or ultrawide display this is a genuinely usable density; on a laptop it is not.
# keys: topLeftNinth topCenterNinth topRightNinth
# middleLeftNinth middleCenterNinth middleRightNinth
# bottomLeftNinth bottomCenterNinth bottomRightNinth
# ctrl+opt+shift+1 .. 3 for the top row
defaults write com.knollsoft.Rectangle topLeftNinth -dict-add keyCode -float 18 modifierFlags -float 917504
defaults write com.knollsoft.Rectangle topCenterNinth -dict-add keyCode -float 19 modifierFlags -float 917504
defaults write com.knollsoft.Rectangle topRightNinth -dict-add keyCode -float 20 modifierFlags -float 917504
The natural binding scheme maps the number row's three rows of three to the grid's geometry — 1/2/3 with one modifier set for the top row, another for the middle, another for the bottom. Nine bindings is a lot to memorise, so most people who use ninths bind only the ones they actually need, typically the centre and the corners.
Monitoring dashboards, trading desks, anyone keeping many small always-visible panels. If you are working with three documents, thirds are better and already have shortcuts.
Eighths: a 4×2 grid
Four columns by two rows. This suits ultrawide displays much better than ninths, because it divides the horizontal axis — which is where an ultrawide has space — without over-dividing the vertical, where it does not.
# keys: topLeftEighth topCenterLeftEighth topCenterRightEighth topRightEighth
# bottomLeftEighth bottomCenterLeftEighth bottomCenterRightEighth bottomRightEighth
defaults write com.knollsoft.Rectangle topLeftEighth -dict-add keyCode -float 18 modifierFlags -float 917504
defaults write com.knollsoft.Rectangle bottomLeftEighth -dict-add keyCode -float 18 modifierFlags -float 1966080
Corner two-thirds
Four commands producing a two-thirds region anchored to a corner — a large primary area with an L-shaped remainder. This is the layout for a dominant main window plus two smaller companions, and it is not otherwise reachable.
# keys: topLeftThird topRightThird bottomLeftThird bottomRightThird
# (these are two-thirds regions, and they cycle through variants when repeated)
defaults write com.knollsoft.Rectangle topLeftThird -dict-add keyCode -float 18 modifierFlags -float 917504
They cycle through several calculations when pressed repeatedly, so one binding reaches more than one geometry. Worth experimenting with before deciding how many you need.
Doubling and halving
Eight commands that double or halve a window's width or height, growing or shrinking toward a named direction. The direction in the name is where the *centre* of the window moves as a result of the resize — which is worth reading twice, because it is the opposite of what most people assume the first time.
| Command | Effect |
|---|---|
| <code>doubleWidthRight</code> | Doubles the width, extending rightward |
| <code>doubleWidthLeft</code> | Doubles the width, extending leftward |
| <code>doubleHeightUp</code> / <code>doubleHeightDown</code> | Doubles the height in that direction |
| <code>halveWidthLeft</code> / <code>halveWidthRight</code> | Halves the width, keeping the named side |
| <code>halveHeightUp</code> / <code>halveHeightDown</code> | Halves the height, keeping the named side |
# ctrl+option+shift+right → double width rightward
defaults write com.knollsoft.Rectangle doubleWidthRight -dict-add keyCode -float 124 modifierFlags -float 917504
# ctrl+option+shift+left → halve width, keeping the left edge
defaults write com.knollsoft.Rectangle halveWidthLeft -dict-add keyCode -float 123 modifierFlags -float 917504
Binary sizing is a different mental model from fractions and suits people who think in terms of "twice as wide" rather than "two thirds of the screen". Four bindings — double and halve, width and height — cover most of the value.
Custom exact sizes
Two commands worth knowing about individually. The first centres a window at an exact pixel size, which is the correct tool for anyone who needs a repeatable viewport — testing a layout at a specific width, recording a screencast at a fixed dimension, or matching a design canvas:
defaults write com.knollsoft.Rectangle specified -dict-add keyCode -float 8 modifierFlags -float 1966080
defaults write com.knollsoft.Rectangle specifiedWidth -float 1680
defaults write com.knollsoft.Rectangle specifiedHeight -float 1050
The second centres horizontally but sits the window slightly above the vertical centre, which reads as better balanced to the eye — the same principle as optical centring in typography:
defaults write com.knollsoft.Rectangle centerProminently -dict-add keyCode -float 8 modifierFlags -float 1835305
Both are considerably more useful than their obscurity suggests. The exact-size command in particular replaces a whole category of fiddly manual resizing for anyone doing repeatable visual work.
Get the current build
Rectangle is free and open source. Everything documented here works in the standard build.
Download from rectangleapp.comQuestions
Why are these not in the settings window?
The interface is deliberately minimal. Commands judged too specialised for most users live only in the preference domain.
Do I need to know keycodes?
Yes, for these. The reference table covers the common keys, and free keycode utilities show any key you press.
Can I bind these to mouse buttons?
Not directly. A tool like BetterTouchTool can map a button to a key combination that these commands are bound to.
Are ninths worth it on a laptop?
No. A ninth of a 14-inch display is too small for anything but a clock. Thirds are the right density there.