mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
code review
This commit is contained in:
@ -5,7 +5,7 @@ enum QuickTerminalPosition : String {
|
|||||||
case bottom
|
case bottom
|
||||||
case left
|
case left
|
||||||
case right
|
case right
|
||||||
case middle
|
case center
|
||||||
|
|
||||||
/// Set the loaded state for a window.
|
/// Set the loaded state for a window.
|
||||||
func setLoaded(_ window: NSWindow) {
|
func setLoaded(_ window: NSWindow) {
|
||||||
@ -27,7 +27,7 @@ enum QuickTerminalPosition : String {
|
|||||||
height: screen.frame.height)
|
height: screen.frame.height)
|
||||||
), display: false)
|
), display: false)
|
||||||
|
|
||||||
case .middle:
|
case .center:
|
||||||
window.setFrame(.init(
|
window.setFrame(.init(
|
||||||
origin: window.frame.origin,
|
origin: window.frame.origin,
|
||||||
size: .init(
|
size: .init(
|
||||||
@ -71,7 +71,7 @@ enum QuickTerminalPosition : String {
|
|||||||
case .left, .right:
|
case .left, .right:
|
||||||
finalSize.height = screen.frame.height
|
finalSize.height = screen.frame.height
|
||||||
|
|
||||||
case .middle:
|
case .center:
|
||||||
finalSize.width = screen.frame.width / 2
|
finalSize.width = screen.frame.width / 2
|
||||||
finalSize.height = screen.frame.height / 3
|
finalSize.height = screen.frame.height / 3
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ enum QuickTerminalPosition : String {
|
|||||||
case .right:
|
case .right:
|
||||||
return .init(x: screen.frame.maxX, y: 0)
|
return .init(x: screen.frame.maxX, y: 0)
|
||||||
|
|
||||||
case .middle:
|
case .center:
|
||||||
return .init(x: (screen.visibleFrame.maxX - window.frame.width) / 2, y: screen.visibleFrame.maxY - window.frame.width)
|
return .init(x: (screen.visibleFrame.maxX - window.frame.width) / 2, y: screen.visibleFrame.maxY - window.frame.width)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ enum QuickTerminalPosition : String {
|
|||||||
case .right:
|
case .right:
|
||||||
return .init(x: screen.visibleFrame.maxX - window.frame.width, y: window.frame.origin.y)
|
return .init(x: screen.visibleFrame.maxX - window.frame.width, y: window.frame.origin.y)
|
||||||
|
|
||||||
case .middle:
|
case .center:
|
||||||
return .init(x: (screen.visibleFrame.maxX - window.frame.width) / 2, y: (screen.visibleFrame.maxY - window.frame.height) / 2)
|
return .init(x: (screen.visibleFrame.maxX - window.frame.width) / 2, y: (screen.visibleFrame.maxY - window.frame.height) / 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1377,6 +1377,7 @@ keybind: Keybinds = .{},
|
|||||||
/// * `bottom` - Terminal appears at the bottom of the screen.
|
/// * `bottom` - Terminal appears at the bottom of the screen.
|
||||||
/// * `left` - Terminal appears at the left of the screen.
|
/// * `left` - Terminal appears at the left of the screen.
|
||||||
/// * `right` - Terminal appears at the right of the screen.
|
/// * `right` - Terminal appears at the right of the screen.
|
||||||
|
/// * `center` - Terminal appears at the center of the screen.
|
||||||
///
|
///
|
||||||
/// Changing this configuration requires restarting Ghostty completely.
|
/// Changing this configuration requires restarting Ghostty completely.
|
||||||
@"quick-terminal-position": QuickTerminalPosition = .top,
|
@"quick-terminal-position": QuickTerminalPosition = .top,
|
||||||
@ -5257,7 +5258,7 @@ pub const QuickTerminalPosition = enum {
|
|||||||
bottom,
|
bottom,
|
||||||
left,
|
left,
|
||||||
right,
|
right,
|
||||||
middle,
|
center,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// See quick-terminal-screen
|
/// See quick-terminal-screen
|
||||||
|
Reference in New Issue
Block a user