bd44b5aa08
Test / build-libghostty-vt (x86_64-windows-gnu) (push) Has been cancelled
Test / build-libghostty-vt-macos (aarch64-ios) (push) Has been cancelled
Test / build-libghostty-vt-macos (aarch64-macos) (push) Has been cancelled
Test / build-libghostty-vt-macos (x86_64-macos) (push) Has been cancelled
Test / build-nix (namespace-profile-ghostty-md-arm64) (push) Has been cancelled
Test / build-dist (push) Has been cancelled
Test / GTK x11=true wayland=true (push) Has been cancelled
Test / Build -Dsimd=false (push) Has been cancelled
Test / Build -Dsimd=true (push) Has been cancelled
Test / Build -Dsentry=false (push) Has been cancelled
Test / Build -Dsentry=true (push) Has been cancelled
Test / zig-fmt (push) Has been cancelled
Test / GitHub Actions Pins (push) Has been cancelled
Test / prettier (push) Has been cancelled
Test / swiftlint (push) Has been cancelled
Test / alejandra (push) Has been cancelled
Test / typos (push) Has been cancelled
Nix / Required Checks: Nix (push) Has been cancelled
Nix / check-zig-cache-hash (push) Has been cancelled
Test / skip (push) Has been cancelled
Test / Required Checks: Test (push) Has been cancelled
Test / build-bench (push) Has been cancelled
Test / list-examples (push) Has been cancelled
Test / Example ${{ matrix.dir }} (Windows) (push) Has been cancelled
Test / build-cmake (push) Has been cancelled
Test / test-lib-vt-pkgconfig (push) Has been cancelled
Test / build-flatpak (push) Has been cancelled
Test / build-snap (push) Has been cancelled
Test / build-libghostty-vt (aarch64-linux) (push) Has been cancelled
Test / build-libghostty-vt (aarch64-macos) (push) Has been cancelled
Test / build-libghostty-vt (wasm32-freestanding) (push) Has been cancelled
Test / build-libghostty-vt (x86_64-linux) (push) Has been cancelled
Test / build-libghostty-vt (x86_64-linux-musl) (push) Has been cancelled
Test / build-libghostty-vt (x86_64-macos) (push) Has been cancelled
Test / build-libghostty-vt-android (aarch64-linux-android) (push) Has been cancelled
Test / build-libghostty-vt-android (arm-linux-androideabi) (push) Has been cancelled
Test / build-libghostty-vt-android (x86_64-linux-android) (push) Has been cancelled
Test / build-libghostty-vt-windows (push) Has been cancelled
Test / build-libghostty-windows-gnu (push) Has been cancelled
Test / build-linux (namespace-profile-ghostty-md) (push) Has been cancelled
Test / build-linux (namespace-profile-ghostty-md-arm64) (push) Has been cancelled
Test / build-linux-libghostty (push) Has been cancelled
Test / build-nix (namespace-profile-ghostty-md) (push) Has been cancelled
Test / build-dist-lib-vt (push) Has been cancelled
Test / trigger-snap (push) Has been cancelled
Test / trigger-flatpak (push) Has been cancelled
Test / build-macos (push) Has been cancelled
Test / build-macos-freetype (push) Has been cancelled
Test / test (push) Has been cancelled
Test / test-lib-vt (push) Has been cancelled
Test / GTK x11=false wayland=false (push) Has been cancelled
Test / GTK x11=true wayland=false (push) Has been cancelled
Test / GTK x11=false wayland=true (push) Has been cancelled
Test / test-macos (push) Has been cancelled
Test / test-windows (push) Has been cancelled
Test / Build -Di18n=false (push) Has been cancelled
Test / Build -Di18n=true (push) Has been cancelled
Test / Build test/fuzz-libghostty (push) Has been cancelled
Test / shellcheck (push) Has been cancelled
Test / translations (push) Has been cancelled
Test / blueprint-compiler (push) Has been cancelled
Test / Test pkg/wuffs (push) Has been cancelled
Test / Test build on Debian 13 (push) Has been cancelled
Test / valgrind (push) Has been cancelled
Test / Example ${{ matrix.dir }} (push) Has been cancelled
113 lines
3.5 KiB
Swift
113 lines
3.5 KiB
Swift
import SwiftUI
|
|
|
|
/// The progress bar to show a surface progress report. We implement this from scratch because the
|
|
/// standard ProgressView is broken on macOS 26 and this is simple anyways and gives us a ton of
|
|
/// control.
|
|
struct SurfaceProgressBar: View {
|
|
let report: Ghostty.Action.ProgressReport
|
|
|
|
private var color: Color {
|
|
switch report.state {
|
|
case .error: return .red
|
|
case .pause: return .orange
|
|
default: return .accentColor
|
|
}
|
|
}
|
|
|
|
private var progress: UInt8? {
|
|
// If we have an explicit progress use that.
|
|
if let v = report.progress { return v }
|
|
|
|
// Otherwise, if we're in the pause state, we act as if we're at 100%.
|
|
if report.state == .pause { return 100 }
|
|
|
|
return nil
|
|
}
|
|
|
|
private var accessibilityLabel: String {
|
|
switch report.state {
|
|
case .error: return "Terminal progress - Error"
|
|
case .pause: return "Terminal progress - Paused"
|
|
case .indeterminate: return "Terminal progress - In progress"
|
|
default: return "Terminal progress"
|
|
}
|
|
}
|
|
|
|
private var accessibilityValue: String {
|
|
if let progress {
|
|
return "\(progress) percent complete"
|
|
} else {
|
|
switch report.state {
|
|
case .error: return "Operation failed"
|
|
case .pause: return "Operation paused at completion"
|
|
case .indeterminate: return "Operation in progress"
|
|
default: return "Indeterminate progress"
|
|
}
|
|
}
|
|
}
|
|
|
|
var body: some View {
|
|
GeometryReader { geometry in
|
|
ZStack(alignment: .leading) {
|
|
if let progress {
|
|
// Determinate progress bar with specific percentage
|
|
Rectangle()
|
|
.fill(color)
|
|
.frame(
|
|
width: geometry.size.width * CGFloat(progress) / 100,
|
|
height: geometry.size.height
|
|
)
|
|
.animation(.easeInOut(duration: 0.2), value: progress)
|
|
} else {
|
|
// Indeterminate states without specific progress - all use bouncing animation
|
|
BouncingProgressBar(color: color)
|
|
}
|
|
}
|
|
}
|
|
.frame(height: 2)
|
|
.clipped()
|
|
.allowsHitTesting(false)
|
|
.accessibilityElement(children: .ignore)
|
|
.accessibilityAddTraits(.updatesFrequently)
|
|
.accessibilityLabel(accessibilityLabel)
|
|
.accessibilityValue(accessibilityValue)
|
|
}
|
|
}
|
|
|
|
/// Bouncing progress bar for indeterminate states
|
|
private struct BouncingProgressBar: View {
|
|
let color: Color
|
|
@State private var position: CGFloat = 0
|
|
|
|
private let barWidthRatio: CGFloat = 0.25
|
|
|
|
var body: some View {
|
|
GeometryReader { geometry in
|
|
ZStack(alignment: .leading) {
|
|
Rectangle()
|
|
.fill(color.opacity(0.3))
|
|
|
|
Rectangle()
|
|
.fill(color)
|
|
.frame(
|
|
width: geometry.size.width * barWidthRatio,
|
|
height: geometry.size.height
|
|
)
|
|
.offset(x: position * (geometry.size.width * (1 - barWidthRatio)))
|
|
}
|
|
}
|
|
.onAppear {
|
|
withAnimation(
|
|
.easeInOut(duration: 1.2)
|
|
.repeatForever(autoreverses: true)
|
|
) {
|
|
position = 1
|
|
}
|
|
}
|
|
.onDisappear {
|
|
position = 0
|
|
}
|
|
}
|
|
}
|
|
|