Skip to content

Terminal Commands for Hidden Preferences

Rectangle Pro is built on top of Rectangle, and many of Rectangle’s settings are outside of the UI, available as Terminal command configurations. These are carried over here to Rectangle Pro, but with the bundle identifier com.knollsoft.Hookshot (Rectangle Pro was initially named Hookshot, and so it remains with the same bundle identifier).

A number of the commands below are for configuring keyboard shortcuts, and you’ll need to know the key code and modifier flags integer values.

By default, Rectangle Pro does not use Spectacle’s keyboard shortcuts. Unlike Rectangle, Rectangle Pro doesn’t provide a toggle for the Spectacle shortcuts, and it is enabled by the following Terminal command.

Terminal window
defaults write com.knollsoft.Hookshot alternateDefaultShortcuts -bool true

Cycle thirds on repeated Center Half commands

Section titled “Cycle thirds on repeated Center Half commands”

Set Center Half to cycle third sizes: 1/2 -> 2/3 -> 1/3 with:

Terminal window
defaults write com.knollsoft.Hookshot centerHalfCycles -int 1

By default, the commands to move to certain edges will not resize the window. If resizeOnDirectionalMove is enabled, the halves to thirds mode is instead used. This means that when moving to the left/right, the width will be changed, and when moving to the top/bottom, the height will be changed. The size will cycle between 1/2 -> 2/3 -> 1/3 of the screen’s width/height.

Note that if subsequent execution mode is set to cycle displays when this is enabled, Move Left and Move Right will always resize to 1/2, and pressing the key again will move to the next display.

Terminal window
defaults write com.knollsoft.Hookshot resizeOnDirectionalMove -bool true

By default, the Stage Manager area will be set to 190 pixels, if enabled.

Terminal window
defaults write com.knollsoft.Hookshot stageSize -float <VALUE>

To set it to a proportion of your screen’s width, set it to a value between 0 and 1.

Terminal window
defaults write com.knollsoft.Hookshot stageSize -float <VALUE_BETWEEN_0_AND_1>

See the wiki for more info.

Terminal window
defaults write com.knollsoft.Hookshot todo -int 1

Only allow drag-to-snap when modifier keys are pressed

Section titled “Only allow drag-to-snap when modifier keys are pressed”

Modifier keys can be combined by summing the Integer Values.

Modifier KeyInteger Value
cmd1048576
option524288
ctrl262144
shift131072
fn8388608

This command would be for restricting snap to the cmd key:

Terminal window
defaults write com.knollsoft.Hookshot snapModifiers -int 1048576

By default, “Almost Maximize” will resize the window to 90% of the screen (width & height).

Terminal window
defaults write com.knollsoft.Hookshot almostMaximizeHeight -float <VALUE_BETWEEN_0_&_1>
Terminal window
defaults write com.knollsoft.Hookshot almostMaximizeWidth -float <VALUE_BETWEEN_0_&_1>

Add an extra centering command with custom size

Section titled “Add an extra centering command with custom size”

This extra command is not available in the UI. You’ll need to know which keycode and modifier flags you want.

Terminal window
defaults write com.knollsoft.Hookshot specified -dict-add keyCode -float 8 modifierFlags -float 1966080
Terminal window
defaults write com.knollsoft.Hookshot specifiedHeight -float 1050
defaults write com.knollsoft.Hookshot specifiedWidth -float 1680

Add an extra centering with prominence command

Section titled “Add an extra centering with prominence command”

There is an extra command that horizontally centers the window but moves up the window vertically slightly from the center to add visual weight. Similar to extra centering, you will need to know which keycode and modifier flags you want.

The key code is:

  • centerProminently

For example, the command for setting the shortcut to ctrl option command C would be:

Terminal window
defaults write com.knollsoft.Hookshot centerProminently -dict-add keyCode -float 8 modifierFlags -float 1835305

Commands for resizing to screen ninths are not available in the UI.

The key codes are:

  • topLeftNinth
  • topCenterNinth
  • topRightNinth
  • middleLeftNinth
  • middleCenterNinth
  • middleRightNinth
  • bottomLeftNinth
  • bottomCenterNinth
  • bottomRightNinth

For example, the command for setting the top left ninth shortcut to ctrl opt shift 1 would be:

Terminal window
defaults write com.knollsoft.Hookshot topLeftNinth -dict-add keyCode -float 18 modifierFlags -float 917504

Commands for resizing to screen eighths are not available in the UI. This divides the screen up into a 4x2 grid.

The key codes are:

  • topLeftEighth
  • topCenterLeftEighth
  • topCenterRightEighth
  • topRightEighth
  • bottomLeftEighth
  • bottomCenterLeftEighth
  • bottomCenterRightEighth
  • bottomRightEighth

For example, the command for setting the top left eighth shortcut to ctrl opt shift 1 would be:

Terminal window
defaults write com.knollsoft.Hookshot topLeftEighth -dict-add keyCode -float 18 modifierFlags -float 917504

Add additional “thirds” sizing commands

Section titled “Add additional “thirds” sizing commands”

These commands for resizing to corner two-thirds are not available in the UI but can be configured via CLI.

The key codes are:

  • topLeftThird
  • topRightThird
  • bottomLeftThird
  • bottomRightThird

(these correspond to two-thirds, and when repeated will cycle through each of the sizes)

For example, the command for setting the top left two-thirds shortcut to ctrl opt shift 1 would be:

Terminal window
defaults write com.knollsoft.Hookshot topLeftThird -dict-add keyCode -float 18 modifierFlags -float 917504

Add doubling/halving window sizing commands

Section titled “Add doubling/halving window sizing commands”

These commands for doubling or halving the window width/height are not available in the UI but can be configured via CLI.

The key codes are:

  • doubleHeightUp
  • doubleHeightDown
  • doubleWidthLeft
  • doubleWidthRight
  • halveHeightUp
  • halveHeightDown
  • halveWidthLeft
  • halveWidthRight

The action direction (e.g., “Right”) is the direction that the center of the window will move towards as a result of resizing.

For example, the command for setting the doubleWidthRight shortcut to ctrl option shift right would be:

Terminal window
defaults write com.knollsoft.Hookshot doubleWidthRight -dict-add keyCode -float 124 modifierFlags -float 11403555

Add additional tiling and cascading commands

Section titled “Add additional tiling and cascading commands”

Commands for tiling and cascading the visible windows are not available in the UI but can be configured via CLI.

The key codes are:

  • tileAll
  • cascadeAll
  • cascadeActiveApp
  • tileActiveApp

tileAll and cascadeAll act on all visible windows.

cascadeActiveApp cascades and brings to the front only windows belonging to the currently active (foremost) app, leaving all other windows alone.

tileActiveApp tiles only windows belonging to the currently active (foremost) app into a grid, leaving all other windows alone.

For example, the command for setting the cascadeActiveApp shortcut to ctrl shift 2 would be:

Terminal window
defaults write com.knollsoft.Hookshot cascadeActiveApp -dict-add keyCode -float 2 modifierFlags -float 393475

Modify the “footprint” displayed for drag-to-snap area

Section titled “Modify the “footprint” displayed for drag-to-snap area”

Adjust the alpha (transparency). Default is 0.3.

Terminal window
defaults write com.knollsoft.Hookshot footprintAlpha -float <VALUE_BETWEEN_0_&_1>

Change the border width. Default is 2 (used to be 1).

Terminal window
defaults write com.knollsoft.Hookshot footprintBorderWidth -float <NUM_PIXELS>

Disable the fade.

Terminal window
defaults write com.knollsoft.Hookshot footprintFade -int 2

Change the color.

Terminal window
defaults write com.knollsoft.Hookshot footprintColor -string "{\"red\":0,\"blue\":0.5,\"green\":0.5}"

Change the animation duration. The value is a multiplier. Default is 0 (no animation).

Terminal window
defaults write com.knollsoft.Hookshot footprintAnimationDurationMultiplier -float <MULTIPLIER>

Move Up/Down/Left/Right: Don’t center on edge

Section titled “Move Up/Down/Left/Right: Don’t center on edge”

By default, the directional move will center the window along the edge that the window is being moved to.

Terminal window
defaults write com.knollsoft.Hookshot centeredDirectionalMove -int 2

By default, “Make Smaller” will decrease the window until it reaches 25% of the screen (width & height).

Terminal window
defaults write com.knollsoft.Hookshot minimumWindowWidth -float <VALUE_BETWEEN_0_&_1>
Terminal window
defaults write com.knollsoft.Hookshot minimumWindowHeight -float <VALUE_BETWEEN_0_&_1>

By default, “Make Smaller” and “Make Larger” change the window height/width by 30 pixels.

Terminal window
defaults write com.knollsoft.Hookshot sizeOffset -float <NUM_PIXELS>

Make Smaller/Make Larger “curtain resize” with gaps

Section titled “Make Smaller/Make Larger “curtain resize” with gaps”

By default, windows touching the edge of the screen will keep those shared edges the same while only resizing the non-shared edge. With window gaps, this is a little ambiguous since the edges don’t actually touch the screen, so you can disable it for traditional, floating resizing:

Terminal window
defaults write com.knollsoft.Hookshot curtainChangeSize -int 2

Each margin is configured separately, and has a default value of 5

Terminal window
defaults write com.knollsoft.Hookshot snapEdgeMarginTop -int 10
defaults write com.knollsoft.Hookshot snapEdgeMarginBottom -int 10
defaults write com.knollsoft.Hookshot snapEdgeMarginLeft -int 10
defaults write com.knollsoft.Hookshot snapEdgeMarginRight -int 10

You can specify gaps at the edges of your screen that will be left uncovered by window resizing operations. This is useful if, for example, you use a dock replacement that should not have windows overlapping it.

Terminal window
defaults write com.knollsoft.Hookshot screenEdgeGapTop -int 10
defaults write com.knollsoft.Hookshot screenEdgeGapBottom -int 10
defaults write com.knollsoft.Hookshot screenEdgeGapLeft -int 10
defaults write com.knollsoft.Hookshot screenEdgeGapRight -int 10

You can also separately specify the gap for a screen with a notch. Useful for multi-display setups if you are using a menu bar replacement.

Terminal window
defaults write com.knollsoft.Hookshot screenEdgeGapTopNotch -int 5

If you want these gaps to be applied on your main screen only, you can set screenEdgeGapsOnMainScreenOnly. Useful for multi-display setups where only one screen has some dock replacement.

Terminal window
defaults write com.knollsoft.Hookshot screenEdgeGapsOnMainScreenOnly -bool true

Each drag to snap area on the edge of a screen can be ignored with a single Terminal command, but it’s a bit field setting so you’ll have to determine the bit field for which ones you want to disable.

BitSnap AreaWindow Action
0TopMaximize
1BottomThirds
2LeftLeft Half
3RightRight Half
4Top LeftTop Left Corner
5Top RightTop Right Corner
6Bottom LeftBottom Left Corner
7Bottom RightBottom Right Corner
8Top Left Below CornerTop Half
9Top Right Below CornerTop Half
10Bottom Left Above CornerBottom Half
11Bottom Right Above CornerBottom Half

To disable the top (maximize) snap area, execute:

Terminal window
defaults write com.knollsoft.Hookshot ignoredSnapAreas -int 1

To disable the Top Half and Bottom Half snap areas, the bit field would be 1111 0000 0000, or 3840

Terminal window
defaults write com.knollsoft.Hookshot ignoredSnapAreas -int 3840

By default, the “Gaps between windows” setting applies to “Maximize” and “Maximize Height”.

To disable the gaps for “Maximize”, execute:

Terminal window
defaults write com.knollsoft.Hookshot applyGapsToMaximize -int 2

To disable the gaps for “Maximize Height”, execute:

Terminal window
defaults write com.knollsoft.Hookshot applyGapsToMaximizeHeight -int 2

Prevent a window that is quickly dragged above the menu bar from going into Mission Control

Section titled “Prevent a window that is quickly dragged above the menu bar from going into Mission Control”

Important: This can cause issues with dragging and dropping in certain apps like Adobe Illustrator, and can affect text selection in a few apps as well.

Windows that are slowly moved above the menu bar will still go into Mission Control.

Once this is enabled, the checkbox for it is visible in the Snap Areas tab of the Preferences window.

Terminal window
defaults write com.knollsoft.Hookshot missionControlDragging -int 2

Change the allowed off-screen distance. The value is in pixels and is tied to the speed. Default is 25.

Terminal window
defaults write com.knollsoft.Hookshot missionControlDraggingAllowedOffscreenDistance -float <DISTANCE>

Change the disallowed duration. The value is in milliseconds. Default is 250.

Terminal window
defaults write com.knollsoft.Hookshot missionControlDraggingDisallowedDuration -int <DURATION>

Change the behavior of double-clicking the window title bar

Section titled “Change the behavior of double-clicking the window title bar”

To disable restore when double-clicked again:

Terminal window
defaults write com.knollsoft.Hookshot doubleClickTitleBarRestore -int 2

To disable double-clicking the window title bar only for specific bundle ids (in example, Outlook):

Terminal window
defaults write com.knollsoft.Hookshot doubleClickTitleBarIgnoredApps -string "[\"com.microsoft.Outlook\"]"

Change the order of displays to order by x coordinate for next and previous display commands

Section titled “Change the order of displays to order by x coordinate for next and previous display commands”

By default, display order is left-to-right, line-by-line. You can change this to be ordered by x coordinate, left-to-right, regardless of which vertical position of the display. This was the default behavior prior to v0.87.

Terminal window
defaults write com.knollsoft.Hookshot screensOrderedByX -int 1