Skip to content

Commit

Permalink
🔀 Merge pull request #577 from ShawnZhong/center-half
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKai77 authored Oct 1, 2024
2 parents 51f9362 + 4631d35 commit 6320ea1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
22 changes: 22 additions & 0 deletions Loop/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -20067,6 +20067,17 @@
}
}
},
"Window Direction/Name: Horizontal Center Half" : {
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Horizontal Center Half"
}
}
}
},
"Window Direction/Name: Horizontal Center Third" : {
"extractionState" : "manual",
"localizations" : {
Expand Down Expand Up @@ -22197,6 +22208,17 @@
}
}
},
"Window Direction/Name: Vertical Center Half" : {
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Vertical Center Half"
}
}
}
},
"Window Direction/Name: Vertical Center Third" : {
"extractionState" : "manual",
"localizations" : {
Expand Down
1 change: 1 addition & 0 deletions Loop/Utilities/RectangleTranslationLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ enum RectangleTranslationLayer {
"bottomHalf": .bottomHalf,
"bottomRight": .bottomRightQuarter,
"center": .center,
"centerHalf": .horizontalCenterHalf,
"larger": .larger,
"leftHalf": .leftHalf,
"maximize": .maximize,
Expand Down
4 changes: 4 additions & 0 deletions Loop/Window Management/WindowDirection+LocalizedString.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ extension WindowDirection {
.init(localized: .init("Window Direction/Name: Bottom Half", defaultValue: "Bottom Half"))
case .leftHalf:
.init(localized: .init("Window Direction/Name: Left Half", defaultValue: "Left Half"))
case .horizontalCenterHalf:
.init(localized: .init("Window Direction/Name: Horizontal Center Half", defaultValue: "Horizontal Center Half"))
case .verticalCenterHalf:
.init(localized: .init("Window Direction/Name: Vertical Center Half", defaultValue: "Vertical Center Half"))
case .topLeftQuarter:
.init(localized: .init("Window Direction/Name: Top Left Quarter", defaultValue: "Top Left Quarter"))
case .topRightQuarter:
Expand Down
5 changes: 4 additions & 1 deletion Loop/Window Management/WindowDirection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum WindowDirection: String, CaseIterable, Identifiable, Codable {

// Halves
case topHalf = "TopHalf", rightHalf = "RightHalf", bottomHalf = "BottomHalf", leftHalf = "LeftHalf"
case horizontalCenterHalf = "HorizontalCenterHalf", verticalCenterHalf = "VerticalCenterHalf"

// Quarters
case topLeftQuarter = "TopLeftQuarter", topRightQuarter = "TopRightQuarter"
Expand Down Expand Up @@ -54,7 +55,7 @@ enum WindowDirection: String, CaseIterable, Identifiable, Codable {

// These are used in the menubar resize submenu & keybind configuratio
static var general: [WindowDirection] { [.fullscreen, .maximize, .almostMaximize, .center, .macOSCenter, .minimize, .hide] }
static var halves: [WindowDirection] { [.topHalf, .bottomHalf, .leftHalf, .rightHalf] }
static var halves: [WindowDirection] { [.topHalf, .verticalCenterHalf, .bottomHalf, .leftHalf, .horizontalCenterHalf, .rightHalf] }
static var quarters: [WindowDirection] { [.topLeftQuarter, .topRightQuarter, .bottomLeftQuarter, .bottomRightQuarter] }
static var horizontalThirds: [WindowDirection] { [.rightThird, .rightTwoThirds, .horizontalCenterThird, .leftTwoThirds, .leftThird] }
static var verticalThirds: [WindowDirection] { [.topThird, .topTwoThirds, .verticalCenterThird, .bottomTwoThirds, .bottomThird] }
Expand Down Expand Up @@ -91,6 +92,8 @@ enum WindowDirection: String, CaseIterable, Identifiable, Codable {
case .rightHalf: .init(x: 1.0 / 2.0, y: 0, width: 1.0 / 2.0, height: 1.0)
case .bottomHalf: .init(x: 0, y: 1.0 / 2.0, width: 1.0, height: 1.0 / 2.0)
case .leftHalf: .init(x: 0, y: 0, width: 1.0 / 2.0, height: 1.0)
case .horizontalCenterHalf: .init(x: 1.0 / 4.0, y: 0, width: 1.0 / 2.0, height: 1.0)
case .verticalCenterHalf: .init(x: 0, y: 1.0 / 4.0, width: 1.0, height: 1.0 / 2.0)
// Quarters
case .topLeftQuarter: .init(x: 0, y: 0, width: 1.0 / 2.0, height: 1.0 / 2.0)
case .topRightQuarter: .init(x: 1.0 / 2.0, y: 0, width: 1.0 / 2.0, height: 1.0 / 2.0)
Expand Down

0 comments on commit 6320ea1

Please sign in to comment.