Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add horizontal/vertical center half #577

Merged
merged 3 commits into from
Oct 1, 2024
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
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
Loading