Skip to content

A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.

mobile: the live card ends up looking like every other card

RoversX0aa68ac27da2
diff --git a/android/app/src/main/java/com/roversx/thinkterm/TerminalScreen.kt b/android/app/src/main/java/com/roversx/thinkterm/TerminalScreen.kt
index 5b44d88f..b846714d 100644
--- a/android/app/src/main/java/com/roversx/thinkterm/TerminalScreen.kt
+++ b/android/app/src/main/java/com/roversx/thinkterm/TerminalScreen.kt
@@ -122,6 +122,9 @@ fun TerminalScreen(host: Host, store: HostStore, onBack: () -> Unit) {
var terminalBounds by remember { mutableStateOf(Rect.Zero) }
var cardBounds by remember { mutableStateOf<Rect?>(null) }
val zoom = remember { Animatable(0f) }
+ // Once in the card the terminal fades into the card's own preview,
+ // so the live card looks like every other one.
+ val fade = remember { Animatable(0f) }
val overviewOpen = overviewShown && zoom.value > 0f
var zoomTarget by remember { mutableStateOf<Rect?>(null) }
@@ -163,6 +166,7 @@ fun TerminalScreen(host: Host, store: HostStore, onBack: () -> Unit) {
fun closeOverview() {
if (!overviewShown) return
scope.launch {
+ fade.animateTo(0f, tween(150))
zoom.animateTo(0f, spring(dampingRatio = 0.9f, stiffness = 400f))
overviewShown = false
zoomTarget = null
@@ -192,7 +196,10 @@ fun TerminalScreen(host: Host, store: HostStore, onBack: () -> Unit) {
cardBounds = frame
if (frame == null || !overviewShown || zoomTarget != null || terminalBounds.width <= 0f) return
zoomTarget = frame
- scope.launch { zoom.animateTo(1f, spring(dampingRatio = 0.85f, stiffness = 300f)) }
+ scope.launch {
+ zoom.animateTo(1f, spring(dampingRatio = 0.85f, stiffness = 300f))
+ if (overviewShown) fade.animateTo(1f, tween(250))
+ }
}
BackHandler {
@@ -264,6 +271,7 @@ fun TerminalScreen(host: Host, store: HostStore, onBack: () -> Unit) {
// The card's own corners, once the terminal is in it.
val r = 13.dp.toPx() / scale * t
shape = RoundedCornerShape(bottomStart = r, bottomEnd = r)
+ alpha = 1f - fade.value
} else {
scaleX = 1f
scaleY = 1f
diff --git a/android/app/src/main/java/com/roversx/thinkterm/TreeSheet.kt b/android/app/src/main/java/com/roversx/thinkterm/TreeSheet.kt
index 1a2bce99..582bdd00 100644
--- a/android/app/src/main/java/com/roversx/thinkterm/TreeSheet.kt
+++ b/android/app/src/main/java/com/roversx/thinkterm/TreeSheet.kt
@@ -539,7 +539,7 @@ fun OverviewScreen(
model.refreshViews()
while (true) {
for (thread in model.threads?.threads ?: emptyList()) {
- if (!thread.live || thread.id == liveThread) continue
+ if (!thread.live) continue
previewPane(thread)?.let { model.requestPreview(it, OVERVIEW_ROWS) }
}
delay(2000)
@@ -690,18 +690,18 @@ private fun ThreadCard(
.background(if (thread.live) model.background else Color.Black.copy(alpha = 0.4f))
.clipToBounds()
) {
+ Text(
+ previewText(model, thread),
+ fontSize = 7.sp,
+ lineHeight = 8.5.sp,
+ fontFamily = FontFamily.Monospace,
+ color = Color.White,
+ modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp, vertical = 7.dp),
+ )
if (live) {
- // The terminal itself lands here; the box reports where.
+ // The terminal itself lands over this, then fades into the
+ // same preview as every other card; the box reports where.
Box(Modifier.fillMaxSize().onGloballyPositioned { onCardBounds(it.boundsInRoot()) })
- } else {
- Text(
- previewText(model, thread),
- fontSize = 7.sp,
- lineHeight = 8.5.sp,
- fontFamily = FontFamily.Monospace,
- color = Color.White,
- modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp, vertical = 7.dp),
- )
}
}
}
diff --git a/ios/Sources/TerminalScreen.swift b/ios/Sources/TerminalScreen.swift
index 95e02ebc..ae772765 100644
--- a/ios/Sources/TerminalScreen.swift
+++ b/ios/Sources/TerminalScreen.swift
@@ -24,11 +24,15 @@ struct TerminalScreen: View {
/// cards fade in around it, as the desktop's Live Overview zooms out.
@State private var overviewOpen = false
@State private var overviewShown = false
+ /// The cards stay while the terminal comes back out of its card.
+ @State private var overviewVisible = false
@State private var terminalFrame: CGRect = .zero
@State private var cardFrame: CGRect?
@State private var zoomScale: CGFloat = 1
@State private var zoomOffset: CGSize = .zero
@State private var zoomClip: CGFloat?
+ /// Once in the card the terminal fades into the card's own preview.
+ @State private var zoomFade: Double = 1
init(host: Host?, store: HostStore?) {
_model = StateObject(wrappedValue: TerminalModel(host: host, store: store))
@@ -39,7 +43,7 @@ struct TerminalScreen: View {
/// else. Every piece of chrome takes the terminal's own background.
var body: some View {
ZStack(alignment: .topLeading) {
- if overviewShown {
+ if overviewVisible {
OverviewScreen(model: model, isPresented: $overviewShown, cardFrame: $cardFrame, liveThread: currentThreadId)
.opacity(overviewOpen ? 1 : 0)
.onChange(of: overviewShown) { _, shown in if !shown { closeOverview() } }
@@ -63,6 +67,7 @@ struct TerminalScreen: View {
}
.scaleEffect(zoomScale, anchor: .topLeading)
.offset(zoomOffset)
+ .opacity(zoomFade)
.zIndex(2)
.allowsHitTesting(!overviewOpen)
statusLine.opacity(overviewOpen ? 0 : 1)
@@ -333,6 +338,7 @@ struct TerminalScreen: View {
model.refreshViews()
cardFrame = nil
overviewShown = true
+ overviewVisible = true
// Without a card of its own (no threads, or none current) the
// terminal only fades.
if currentThreadId == nil {
@@ -356,14 +362,24 @@ struct TerminalScreen: View {
)
zoomClip = clip
}
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) {
+ guard overviewOpen else { return }
+ withAnimation(.easeOut(duration: 0.25)) { zoomFade = 0 }
+ }
}
private func closeOverview() {
- withAnimation(.spring(response: 0.35, dampingFraction: 0.9)) {
- overviewOpen = false
- zoomScale = 1
- zoomOffset = .zero
- zoomClip = nil
+ withAnimation(.easeOut(duration: 0.15)) { zoomFade = 1 }
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.15) {
+ withAnimation(.spring(response: 0.35, dampingFraction: 0.9)) {
+ overviewOpen = false
+ zoomScale = 1
+ zoomOffset = .zero
+ zoomClip = nil
+ }
+ }
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
+ if !overviewShown { overviewVisible = false }
}
cardFrame = nil
}
diff --git a/ios/Sources/TreeSheet.swift b/ios/Sources/TreeSheet.swift
index cff62cdf..d4607429 100644
--- a/ios/Sources/TreeSheet.swift
+++ b/ios/Sources/TreeSheet.swift
@@ -340,7 +340,7 @@ struct OverviewScreen: View {
/// Every live thread's current tab, asked for its last rows.
private func refreshPreviews() {
- for thread in threads where thread.live && thread.id != liveThread {
+ for thread in threads where thread.live {
if let pane = previewPane(thread) {
model.requestPreview(pane: pane, rows: rows)
}
@@ -395,22 +395,23 @@ struct OverviewScreen: View {
}
.padding(.horizontal, 10)
.padding(.bottom, 7)
- Group {
+ ZStack(alignment: .topLeading) {
+ Text(preview(thread))
+ .font(.system(size: 7, design: .monospaced))
+ .lineSpacing(1)
+ .frame(maxWidth: .infinity, alignment: .topLeading)
+ .padding(.horizontal, 8)
+ .padding(.vertical, 7)
if live {
- // The terminal itself lands here; the frame is reported.
+ // The terminal itself lands over this, then fades into
+ // the same preview as every other card; the frame is
+ // reported so the screen above knows where.
Color.clear
.background(GeometryReader { geo in
Color.clear
.onAppear { cardFrame = geo.frame(in: .named("screen")) }
.onChange(of: geo.frame(in: .named("screen"))) { _, f in cardFrame = f }
})
- } else {
- Text(preview(thread))
- .font(.system(size: 7, design: .monospaced))
- .lineSpacing(1)
- .frame(maxWidth: .infinity, alignment: .topLeading)
- .padding(.horizontal, 8)
- .padding(.vertical, 7)
}
}
.frame(height: 92, alignment: .topLeading)