mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
feat: add support for middle position in quick terminal
This update introduces the ability to launch the quick terminal in the middle position. Resolves #2494
This commit is contained in:
@ -5,6 +5,7 @@ enum QuickTerminalPosition : String {
|
||||
case bottom
|
||||
case left
|
||||
case right
|
||||
case middle
|
||||
|
||||
/// Set the loaded state for a window.
|
||||
func setLoaded(_ window: NSWindow) {
|
||||
@ -25,6 +26,14 @@ enum QuickTerminalPosition : String {
|
||||
width: screen.frame.width / 4,
|
||||
height: screen.frame.height)
|
||||
), display: false)
|
||||
|
||||
case .middle:
|
||||
window.setFrame(.init(
|
||||
origin: window.frame.origin,
|
||||
size: .init(
|
||||
width: screen.frame.width / 2,
|
||||
height: screen.frame.height / 3)
|
||||
), display: false)
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,6 +70,10 @@ enum QuickTerminalPosition : String {
|
||||
|
||||
case .left, .right:
|
||||
finalSize.height = screen.frame.height
|
||||
|
||||
case .middle:
|
||||
finalSize.width = screen.frame.width / 2
|
||||
finalSize.height = screen.frame.height / 3
|
||||
}
|
||||
|
||||
return finalSize
|
||||
@ -80,6 +93,9 @@ enum QuickTerminalPosition : String {
|
||||
|
||||
case .right:
|
||||
return .init(x: screen.frame.maxX, y: 0)
|
||||
|
||||
case .middle:
|
||||
return .init(x: (screen.visibleFrame.maxX - window.frame.width) / 2, y: screen.visibleFrame.maxY - window.frame.width)
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,6 +113,9 @@ enum QuickTerminalPosition : String {
|
||||
|
||||
case .right:
|
||||
return .init(x: screen.visibleFrame.maxX - window.frame.width, y: window.frame.origin.y)
|
||||
|
||||
case .middle:
|
||||
return .init(x: (screen.visibleFrame.maxX - window.frame.width) / 2, y: (screen.visibleFrame.maxY - window.frame.height) / 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5257,6 +5257,7 @@ pub const QuickTerminalPosition = enum {
|
||||
bottom,
|
||||
left,
|
||||
right,
|
||||
middle,
|
||||
};
|
||||
|
||||
/// See quick-terminal-screen
|
||||
|
Reference in New Issue
Block a user