Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions Rectangle/WindowAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,15 @@ enum WindowAction: Int, Codable {
halveWidthLeft = 78,
halveWidthRight = 79,
largerWidth = 80,
smallerWidth = 81
smallerWidth = 81,
largerHeight = 82,
smallerHeight = 83

// Order matters here - it's used in the menu
static let active = [leftHalf, rightHalf, centerHalf, topHalf, bottomHalf,
topLeft, topRight, bottomLeft, bottomRight,
firstThird, centerThird, lastThird, firstTwoThirds, lastTwoThirds,
maximize, almostMaximize, maximizeHeight, larger, smaller, largerWidth, smallerWidth,
maximize, almostMaximize, maximizeHeight, larger, smaller, largerWidth, smallerWidth, largerHeight, smallerHeight,
center, centerProminently, restore,
nextDisplay, previousDisplay,
moveLeft, moveRight, moveUp, moveDown,
Expand Down Expand Up @@ -230,6 +232,8 @@ enum WindowAction: Int, Codable {
case .centerProminently: return "centerProminently"
case .largerWidth: return "largerWidth"
case .smallerWidth: return "smallerWidth"
case .largerHeight: return "largerHeight"
case .smallerHeight: return "smallerHeight"
}
}

Expand Down Expand Up @@ -366,7 +370,7 @@ enum WindowAction: Int, Codable {
return nil
case .specified, .reverseAll, .tileAll, .cascadeAll, .leftTodo, .rightTodo, .cascadeActiveApp:
return nil
case .centerProminently, .largerWidth, .smallerWidth:
case .centerProminently, .largerWidth, .smallerWidth, .largerHeight, .smallerHeight:
return nil
}

Expand Down Expand Up @@ -544,6 +548,8 @@ enum WindowAction: Int, Codable {
case .centerProminently: return NSImage()
case .largerWidth: return NSImage()
case .smallerWidth: return NSImage()
case .largerHeight: return NSImage()
case .smallerHeight: return NSImage()
}
}

Expand Down Expand Up @@ -586,7 +592,7 @@ enum WindowAction: Int, Codable {
return Defaults.applyGapsToMaximize.userDisabled ? .none : .both;
case .maximizeHeight:
return Defaults.applyGapsToMaximizeHeight.userDisabled ? .none : .vertical;
case .almostMaximize, .previousDisplay, .nextDisplay, .larger, .smaller, .largerWidth, .smallerWidth, .center, .centerProminently, .restore, .specified, .reverseAll, .tileAll, .cascadeAll, .cascadeActiveApp:
case .almostMaximize, .previousDisplay, .nextDisplay, .larger, .smaller, .largerWidth, .smallerWidth, .largerHeight, .smallerHeight, .center, .centerProminently, .restore, .specified, .reverseAll, .tileAll, .cascadeAll, .cascadeActiveApp:
return .none
}
}
Expand Down
8 changes: 4 additions & 4 deletions Rectangle/WindowCalculation/ChangeSizeCalculation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class ChangeSizeCalculation: WindowCalculation, ChangeWindowDimensionCalculation

let sizeOffset: CGFloat
switch params.action {
case .larger, .largerWidth:
case .larger, .largerWidth, .largerHeight:
sizeOffset = sizeOffsetAbs
case .smaller, .smallerWidth:
case .smaller, .smallerWidth, .smallerHeight:
sizeOffset = -sizeOffsetAbs
default:
sizeOffset = 0
Expand Down Expand Up @@ -62,7 +62,7 @@ class ChangeSizeCalculation: WindowCalculation, ChangeWindowDimensionCalculation

// Calculate Height

if [.larger, .smaller].contains(params.action) {
if [.larger, .smaller, .largerHeight, .smallerHeight].contains(params.action) {
resizedWindowRect.size.height = resizedWindowRect.height + sizeOffset
resizedWindowRect.origin.y = resizedWindowRect.minY - floor(sizeOffset / 2.0)

Expand All @@ -88,7 +88,7 @@ class ChangeSizeCalculation: WindowCalculation, ChangeWindowDimensionCalculation
resizedWindowRect.origin.y = params.window.rect.origin.y - floor(sizeOffset / 2.0)
}

if [.smaller, .smallerWidth].contains(params.action), resizedWindowRectIsTooSmall(windowRect: resizedWindowRect, visibleFrameOfScreen: visibleFrameOfScreen) {
if [.smaller, .smallerWidth, .smallerHeight].contains(params.action), resizedWindowRectIsTooSmall(windowRect: resizedWindowRect, visibleFrameOfScreen: visibleFrameOfScreen) {
resizedWindowRect = window.rect
}

Expand Down
2 changes: 2 additions & 0 deletions Rectangle/WindowCalculation/WindowCalculation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ class WindowCalculationFactory {
.smaller: changeSizeCalculation,
.largerWidth: changeSizeCalculation,
.smallerWidth: changeSizeCalculation,
.largerHeight: changeSizeCalculation,
.smallerHeight: changeSizeCalculation,
.bottomHalf: bottomHalfCalculation,
.topHalf: topHalfCalculation,
.center: centerCalculation,
Expand Down
12 changes: 12 additions & 0 deletions TerminalCommands.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The preferences window is purposefully slim, but there's a lot that can be modif
- [Make Smaller/Make Larger size increments](#make-smallermake-larger-size-increments)
- [Make Smaller/Make Larger "curtain resize" with gaps](#make-smallermake-larger-curtain-resize-with-gaps)
- [Make Smaller/Make Larger width only](#make-smallermake-larger-width-only)
- [Make Smaller/Make Larger height only](#make-smallermake-larger-height-only)
- [Disabling window restore when moving windows](#disabling-window-restore-when-moving-windows)
- [Changing the margin for the snap areas](#changing-the-margin-for-the-snap-areas)
- [Setting gaps at the screen edges](#setting-gaps-at-the-screen-edges)
Expand Down Expand Up @@ -345,6 +346,17 @@ defaults write com.knollsoft.Rectangle largerWidth -dict-add keyCode -float 30 m
defaults write com.knollsoft.Rectangle smallerWidth -dict-add keyCode -float 33 modifierFlags -float 786432
```

## Make Smaller/Make Larger height only

Similarly, if you only want to change the window height without changing window width, configure shortcuts for the _largerHeight_ and _smallerHeight_ commands.

For example, if you want to assign `ctrl option shift ]` to _largerHeight_ and `ctrl option shift [` to _smallerHeight_, the commands would be:

```bash
defaults write com.knollsoft.Rectangle largerHeight -dict-add keyCode -float 30 modifierFlags -float 917504
defaults write com.knollsoft.Rectangle smallerHeight -dict-add keyCode -float 33 modifierFlags -float 917504
```

## Disabling window restore when moving windows

```bash
Expand Down