mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-01 15:38:35 +00:00
macos: render a terminal in the slide window
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import Cocoa
|
||||
|
||||
enum SlideTerminalPosition {
|
||||
case top
|
||||
|
||||
/// Set the initial state for a window for animating out of this position.
|
||||
func setInitial(in window: NSWindow, on screen: NSScreen) {
|
||||
// We always start invisible
|
||||
window.alphaValue = 0
|
||||
|
||||
// Position depends
|
||||
switch (self) {
|
||||
case .top:
|
||||
window.setFrame(.init(
|
||||
origin: .init(
|
||||
x: 0,
|
||||
y: screen.frame.maxY),
|
||||
size: .init(
|
||||
width: screen.frame.width,
|
||||
height: window.frame.height)
|
||||
), display: false)
|
||||
}
|
||||
}
|
||||
|
||||
/// Set the final state for a window in this position.
|
||||
func setFinal(in window: NSWindow, on screen: NSScreen) {
|
||||
// We always end visible
|
||||
window.alphaValue = 1
|
||||
|
||||
// Position depends
|
||||
switch (self) {
|
||||
case .top:
|
||||
window.setFrame(.init(
|
||||
origin: .init(
|
||||
x: window.frame.origin.x,
|
||||
y: screen.visibleFrame.maxY - window.frame.height),
|
||||
size: window.frame.size
|
||||
), display: true)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user