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
4 changes: 4 additions & 0 deletions Rectangle.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
98FA9497235A2D7600F95C4F /* RepeatedExecutionsCalculation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98FA9496235A2D7600F95C4F /* RepeatedExecutionsCalculation.swift */; };
98FD7C5F2687BC14009E9DAF /* FirstThreeFourthsCalculation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98FD7C5E2687BC14009E9DAF /* FirstThreeFourthsCalculation.swift */; };
98FD7C612687BCB6009E9DAF /* LastThreeFourthsCalculation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98FD7C602687BCB6009E9DAF /* LastThreeFourthsCalculation.swift */; };
9FF740232E34DE9000D22955 /* CenterThreeFourthsCalculation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF740222E34DE9000D22955 /* CenterThreeFourthsCalculation.swift */; };
AA040C67290B2640003181D5 /* RunLoopThread.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA040C66290B2640003181D5 /* RunLoopThread.swift */; };
AA0AC000291C1B5E00D125D2 /* CGExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0ABFFF291C1B5E00D125D2 /* CGExtension.swift */; };
AA0AC002291C1B9100D125D2 /* AXExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0AC001291C1B9100D125D2 /* AXExtension.swift */; };
Expand Down Expand Up @@ -296,6 +297,7 @@
98FA9496235A2D7600F95C4F /* RepeatedExecutionsCalculation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RepeatedExecutionsCalculation.swift; sourceTree = "<group>"; };
98FD7C5E2687BC14009E9DAF /* FirstThreeFourthsCalculation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstThreeFourthsCalculation.swift; sourceTree = "<group>"; };
98FD7C602687BCB6009E9DAF /* LastThreeFourthsCalculation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LastThreeFourthsCalculation.swift; sourceTree = "<group>"; };
9FF740222E34DE9000D22955 /* CenterThreeFourthsCalculation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CenterThreeFourthsCalculation.swift; sourceTree = "<group>"; };
AA040C66290B2640003181D5 /* RunLoopThread.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunLoopThread.swift; sourceTree = "<group>"; };
AA0ABFFF291C1B5E00D125D2 /* CGExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CGExtension.swift; sourceTree = "<group>"; };
AA0AC001291C1B9100D125D2 /* AXExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AXExtension.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -402,6 +404,7 @@
982140E922B7DA3100ABFB3F /* WindowCalculation */ = {
isa = PBXGroup;
children = (
9FF740222E34DE9000D22955 /* CenterThreeFourthsCalculation.swift */,
74804F0A2E25521C009F1F7D /* CenterTwoThirdsCalculation.swift */,
98A009AA2512491300CFBF0C /* CenterHalfCalculation.swift */,
98A009AC2512498000CFBF0C /* FirstFourthCalculation.swift */,
Expand Down Expand Up @@ -890,6 +893,7 @@
9821402722B3888100ABFB3F /* ChangeSizeCalculation.swift in Sources */,
6490B39927BF97BB0056C220 /* TopCenterRightEighthCalculation.swift in Sources */,
98B3559823CE025700E410E0 /* CenteringFixedSizedWindowMover.swift in Sources */,
9FF740232E34DE9000D22955 /* CenterThreeFourthsCalculation.swift in Sources */,
729E0A982AFF76B1006E2F48 /* CenterProminentlyCalculation.swift in Sources */,
9824704E22B189250037B409 /* QuantizedWindowMover.swift in Sources */,
AA536C2729005DD000579AC6 /* TimeoutCache.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "centerThreeFourthsTemplate.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 74 additions & 21 deletions Rectangle/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Rectangle/PrefsWindow/PrefsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class PrefsViewController: NSViewController {
@IBOutlet weak var thirdFourthShortcutView: MASShortcutView!
@IBOutlet weak var lastFourthShortcutView: MASShortcutView!
@IBOutlet weak var firstThreeFourthsShortcutView: MASShortcutView!
@IBOutlet weak var centerThreeFourthsShortcutView: MASShortcutView!
@IBOutlet weak var lastThreeFourthsShortcutView: MASShortcutView!

@IBOutlet weak var topLeftSixthShortcutView: MASShortcutView!
Expand Down Expand Up @@ -105,6 +106,7 @@ class PrefsViewController: NSViewController {
.thirdFourth: thirdFourthShortcutView,
.lastFourth: lastFourthShortcutView,
.firstThreeFourths: firstThreeFourthsShortcutView,
.centerThreeFourths: centerThreeFourthsShortcutView,
.lastThreeFourths: lastThreeFourthsShortcutView,
.topLeftSixth: topLeftSixthShortcutView,
.topCenterSixth: topCenterSixthShortcutView,
Expand Down
18 changes: 14 additions & 4 deletions Rectangle/WindowAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ enum WindowAction: Int, Codable {
smallerWidth = 81,
largerHeight = 82,
smallerHeight = 83,
centerTwoThirds = 84
centerTwoThirds = 84,
centerThreeFourths = 85

// Order matters here - it's used in the menu
static let active = [leftHalf, rightHalf, centerHalf, topHalf, bottomHalf,
Expand All @@ -107,7 +108,7 @@ enum WindowAction: Int, Codable {
center, centerProminently, restore,
nextDisplay, previousDisplay,
moveLeft, moveRight, moveUp, moveDown,
firstFourth, secondFourth, thirdFourth, lastFourth, firstThreeFourths, lastThreeFourths,
firstFourth, secondFourth, thirdFourth, lastFourth, firstThreeFourths, centerThreeFourths, lastThreeFourths,
topLeftSixth, topCenterSixth, topRightSixth, bottomLeftSixth, bottomCenterSixth, bottomRightSixth,
specified, reverseAll,
topLeftNinth, topCenterNinth, topRightNinth,
Expand Down Expand Up @@ -188,6 +189,7 @@ enum WindowAction: Int, Codable {
case .thirdFourth: return "thirdFourth"
case .lastFourth: return "lastFourth"
case .firstThreeFourths: return "firstThreeFourths"
case .centerThreeFourths: return "centerThreeFourths"
case .lastThreeFourths: return "lastThreeFourths"
case .topLeftSixth: return "topLeftSixth"
case .topCenterSixth: return "topCenterSixth"
Expand Down Expand Up @@ -343,6 +345,9 @@ enum WindowAction: Int, Codable {
case .firstThreeFourths:
key = "T9Z-QF-gwc.title"
value = "First Three Fourths"
case .centerThreeFourths:
key = "Vph-Z0-euH.title"
value = "Center Three Fourths"
case .lastThreeFourths:
key = "nwX-h6-fwm.title"
value = "Last Three Fourths"
Expand Down Expand Up @@ -509,6 +514,7 @@ enum WindowAction: Int, Codable {
case .thirdFourth: return NSImage(imageLiteralResourceName: "centerRightFourthTemplate")
case .lastFourth: return NSImage(imageLiteralResourceName: "rightFourthTemplate")
case .firstThreeFourths: return NSImage(imageLiteralResourceName: "firstThreeFourthsTemplate")
case .centerThreeFourths: return NSImage(imageLiteralResourceName: "centerThreeFourthsTemplate")
case .lastThreeFourths: return NSImage(imageLiteralResourceName: "lastThreeFourthsTemplate")
case .topLeftSixth: return NSImage(imageLiteralResourceName: "topLeftSixthTemplate")
case .topCenterSixth: return NSImage(imageLiteralResourceName: "topCenterSixthTemplate")
Expand Down Expand Up @@ -581,7 +587,7 @@ enum WindowAction: Int, Codable {
var gapsApplicable: Dimension {
switch self {
case .leftHalf, .rightHalf, .bottomHalf, .topHalf, .centerHalf, .bottomLeft, .bottomRight, .topLeft, .topRight, .firstThird, .firstTwoThirds, .centerThird, .centerTwoThirds, .lastTwoThirds, .lastThird,
.firstFourth, .secondFourth, .thirdFourth, .lastFourth, .firstThreeFourths, .lastThreeFourths, .topLeftSixth, .topCenterSixth, .topRightSixth, .bottomLeftSixth, .bottomCenterSixth, .bottomRightSixth,
.firstFourth, .secondFourth, .thirdFourth, .lastFourth, .firstThreeFourths, .centerThreeFourths, .lastThreeFourths, .topLeftSixth, .topCenterSixth, .topRightSixth, .bottomLeftSixth, .bottomCenterSixth, .bottomRightSixth,
.topLeftNinth, .topCenterNinth, .topRightNinth, .middleLeftNinth, .middleCenterNinth, .middleRightNinth, .bottomLeftNinth, .bottomCenterNinth, .bottomRightNinth,
.topLeftThird, .topRightThird, .bottomLeftThird, .bottomRightThird,
.topLeftEighth, .topCenterLeftEighth, .topCenterRightEighth, .topRightEighth,
Expand All @@ -605,7 +611,7 @@ enum WindowAction: Int, Codable {

var category: WindowActionCategory? { // used to specify a submenu
switch self {
case .firstFourth, .secondFourth, .thirdFourth, .lastFourth, .firstThreeFourths, .lastThreeFourths: return .fourths
case .firstFourth, .secondFourth, .thirdFourth, .lastFourth, .firstThreeFourths, .centerThreeFourths, .lastThreeFourths: return .fourths
case .topLeftSixth, .topCenterSixth, .topRightSixth, .bottomLeftSixth, .bottomCenterSixth, .bottomRightSixth: return .sixths
case .moveUp, .moveDown, .moveLeft, .moveRight: return .move
default: return nil
Expand Down Expand Up @@ -652,6 +658,8 @@ enum SubWindowAction {
bottomThreeFourths,
leftThreeFourths,
topThreeFourths,
centerVerticalThreeFourths,
centerHorizontalThreeFourths,

centerVerticalHalf,
centerHorizontalHalf,
Expand Down Expand Up @@ -733,6 +741,8 @@ enum SubWindowAction {
case .bottomThreeFourths: return .top
case .leftThreeFourths: return .right
case .topThreeFourths: return .bottom
case .centerVerticalThreeFourths: return [.right, .left]
case .centerHorizontalThreeFourths: return [.top, .bottom]
case .centerVerticalHalf: return [.right, .left]
case .centerHorizontalHalf: return [.top, .bottom]
case .topLeftSixthLandscape: return [.right, .bottom]
Expand Down
36 changes: 36 additions & 0 deletions Rectangle/WindowCalculation/CenterThreeFourthsCalculation.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// CenterThreeFourthsCalculation.swift
// Rectangle
//
// Created by Tom Grimwood-Taylor on 26/07/2025.
// Copyright © 2025 Ryan Hanson. All rights reserved.
//

import Foundation

class CenterThreeFourthsCalculation: WindowCalculation, OrientationAware {

override func calculateRect(_ params: RectCalculationParameters) -> RectResult {
let visibleFrameOfScreen = params.visibleFrameOfScreen
return orientationBasedRect(visibleFrameOfScreen)
}

func landscapeRect(_ visibleFrameOfScreen: CGRect) -> RectResult {
var rect = visibleFrameOfScreen
rect.origin.x = visibleFrameOfScreen.minX + floor(visibleFrameOfScreen.width / 4.0) / 2
rect.origin.y = visibleFrameOfScreen.minY
rect.size.width = visibleFrameOfScreen.width / 4.0 * 3
rect.size.height = visibleFrameOfScreen.height
return RectResult(rect, subAction: .centerVerticalThreeFourths)
}

func portraitRect(_ visibleFrameOfScreen: CGRect) -> RectResult {
var rect = visibleFrameOfScreen
rect.origin.x = visibleFrameOfScreen.minX
rect.origin.y = visibleFrameOfScreen.minY + floor(visibleFrameOfScreen.height / 4.0) / 2
rect.size.width = visibleFrameOfScreen.width
rect.size.height = visibleFrameOfScreen.height / 4.0 * 3
return RectResult(rect, subAction: .centerHorizontalThreeFourths)
}
}

2 changes: 2 additions & 0 deletions Rectangle/WindowCalculation/WindowCalculation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class WindowCalculationFactory {
static let thirdFourthCalculation = ThirdFourthCalculation()
static let lastFourthCalculation = LastFourthCalculation()
static let firstThreeFourthsCalculation = FirstThreeFourthsCalculation()
static let centerThreeFourthsCalculation = CenterThreeFourthsCalculation()
static let lastThreeFourthsCalculation = LastThreeFourthsCalculation()
static let topLeftSixthCalculation = TopLeftSixthCalculation()
static let topCenterSixthCalculation = TopCenterSixthCalculation()
Expand Down Expand Up @@ -223,6 +224,7 @@ class WindowCalculationFactory {
.thirdFourth: thirdFourthCalculation,
.lastFourth: lastFourthCalculation,
.firstThreeFourths: firstThreeFourthsCalculation,
.centerThreeFourths: centerThreeFourthsCalculation,
.lastThreeFourths: lastThreeFourthsCalculation,
.topLeftSixth: topLeftSixthCalculation,
.topCenterSixth: topCenterSixthCalculation,
Expand Down
20 changes: 19 additions & 1 deletion Rectangle/mul.lproj/Main.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -45004,6 +45004,24 @@
}
}
},
"Vph-Z0-euH.title" : {
"comment" : "Class = \"NSTextFieldCell\"; title = \"Center Three Fourths\"; ObjectID = \"Vph-Z0-euH\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Center Three Fourths"
}
},
"en-GB" : {
"stringUnit" : {
"state" : "translated",
"value" : "Centre Three Quarters"
}
}
}
},
"w0m-vy-SC9.title" : {
"comment" : "Class = \"NSMenu\"; title = \"Ligatures\"; ObjectID = \"w0m-vy-SC9\";",
"extractionState" : "manual",
Expand Down Expand Up @@ -49908,4 +49926,4 @@
}
},
"version" : "1.0"
}
}
Loading