Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(mobile): align Duo hardware openings with host aspect and safe controls

Dashf87c87a4dc5e
diff --git a/apps/mobile/assets/retro-mac/README.md b/apps/mobile/assets/retro-mac/README.md
index 3a1e528eb3..daa0d6f2ce 100644
--- a/apps/mobile/assets/retro-mac/README.md
+++ b/apps/mobile/assets/retro-mac/README.md
@@ -5,28 +5,29 @@ Generated on 2026-10-24 with OpenAI image_gen, following the owner’s request f
Reference: https://x.com/snsnotecom/status/2113540405891625291 (physical cream miniature laptop).
Prompt direction:
+
- display.webp: orthographic front view of a 1984 Macintosh-inspired aged ivory molded-plastic display fascia, fine grain, thick recessed black CRT opening, lower chin, floppy slot on the right, subtle Cindy 84 mark on the left. Upper-left studio lighting; no Apple logo, app UI or outside background.
- deck.webp: matching orthographic top view of an ivory keyboard deck, recessed empty keyboard well and lower central trackpad; same plastic grain and studio lighting, no keys or UI.
- keycap.webp: one unlettered ivory vintage mechanical keycap, sculpted bevels and soft shadow, orthographic top view, transparent background.
Delivery: generated PNGs resized/encoded as WebP (display/deck 1536×1024, keycap 192×192). Text, pointer targets and keyboard input are live React Native components. Screen content is the existing remote viewer; historical screenshots used for visual previews are not bundled here.
-
## Space-efficient variants (2026-10-24)
Built-in OpenAI image_gen; reference inputs were display.webp and deck.webp. Original artwork is retained.
Final prompt set:
+
- display-compact.webp: exact orthographic 1536×1024 ivory molded ABS fascia, keep realistic plastic grain, chamfers and antique Macintosh character; enlarge the empty black opening to nearly the whole frame, narrow sides/top and a small lower chin with Cindy 84 and floppy slot. No perspective or app UI.
- display-edge.webp: matching physical ivory fascia, maximize black display with only a narrow sculpted rim and dark recessed gasket; remove chin, slot and lettering. Fine plastic grain and upper-left studio light; no UI or external scene.
- deck-rail.webp / deck-keys.webp / deck-pad.webp: one matching orthographic 1536×1024 ivory deck, near-full-width empty keyboard recess and broad lower trackpad, minimal borders and palm rest, blank top appearance strip; no keys, labels, logos or speakers. Exported into three horizontal bands (0–110, 110–680, 680–1024) so the real keyboard and touchpad can adapt independently to the available height without shrinking touch targets.
-Viewport rectangles follow the actual generated openings, not the requested prompt coordinates. The slim and full-screen live surfaces use approximately 67% and 77% of the upper media pane respectively, compared with 43% for classic. This is available viewport area, not a claim that every remote aspect ratio fills it.
-
+Source slice boundaries follow the measured inner glass edges in each 1536×1024 image, not an inset within the black glass: classic `(170,144)–(1367,761)`, compact `(70,67)–(1468,848)`, edge `(67,68)–(1471,954)`. The surrounding case is resized around the exact live-view rectangle so no extra black glass is retained as a second frame. The destination opening is enlarged separately and fitted to the host display aspect inside the safe region; the remote image itself is never stretched.
## Historical computer collection (2026-10-24)
Generated with built-in OpenAI image_gen using real product-photo references:
+
- Macintosh II: https://theapplemuseum.org/html/main/x-mac-ii.html (1987; separate desktop/monitor adapted to a foldable UI).
- PowerBook 170: https://www.mac-museum.com/apple-geraete/powerbook-170.html (1991; graphite case, trackball and rainbow Apple badge).
- ThinkPad 701C: https://www.computerhistory.org/revolution/artifact/317/1803 and https://mcomputers.cz/2022/10/05/thinkpad-30-let/thinkpad-701c/ (1995; black case, red TrackPoint and butterfly keyboard reference).
@@ -34,6 +35,7 @@ Generated with built-in OpenAI image_gen using real product-photo references:
These are generated historical homages, not original manufacturer artwork. Enlarged displays, simplified live keyboard layouts and invisible palmrest input adapt the physical designs to Duo; the butterfly mechanism is not simulated. The screen always remains the live remote desktop, regardless of hardware skin.
Final prompt set:
+
- macii-* / powerbook-* / thinkpad-*: photoreal orthographic hardware atlas, front display above top-view deck, equal panels, no perspective or exterior scene; enlarged empty black screen with narrow brand strip, near-full-width empty keyboard well for live keys. Preserve each reference’s real molded material, subtle bevels, characteristic logo and details. Macintosh II: platinum Snow White grooves, six-stripe rainbow Apple and green LED, small center touchpad as an adaptation. PowerBook: dark gray, rainbow Apple, latch/hinges and compact gray trackball/buttons. ThinkPad: black rubberized material, IBM/701C lettering, stepped keyboard seam, compact red-accent buttons, no rectangular pad.
- keycap-dark.webp: single unlettered graphite ABS vintage laptop keycap, concave top and bevels, upper-left studio light, transparent background.
- trackpoint.webp: single classic red rubber ThinkPad cap, dimple texture, orthographic top view, transparent background.
@@ -42,5 +44,6 @@ Final prompt set:
Atlas slices are separated into display, rail, keyboard backing, blank palmrest texture and small control sprites. Pointing controls preserve their own aspect ratio while their input surface spans the entire palmrest; key/rail hit areas remain separate. Original three study skins are retained. No third-party reference photos are included in the app bundle.
Additional finishing prompts (built-in image_gen):
+
- *-palm-v2.webp: three equal edge-to-edge blank material samples (platinum ABS / graphite ABS / black soft-touch rubber), subtle fine grain with diffuse lighting, no gradients, controls, logos or borders. Each sample is extracted separately and covers the palmrest without stretching grain.
- powerbook-control-cutout.webp: preserve the photographed trackball and two curved buttons, remove all surrounding palmrest and the gap between controls to true transparency; retain shapes, rim and lighting.
diff --git a/apps/mobile/src/remote-desktop/FoldDesktopSkin.tsx b/apps/mobile/src/remote-desktop/FoldDesktopSkin.tsx
index 81b892ae33..4e74d135c6 100644
--- a/apps/mobile/src/remote-desktop/FoldDesktopSkin.tsx
+++ b/apps/mobile/src/remote-desktop/FoldDesktopSkin.tsx
@@ -39,9 +39,29 @@ const VIEWPORTS = {
macii: { x: 0.072, y: 0.082, width: 0.856, height: 0.73 },
powerbook: { x: 0.08, y: 0.11, width: 0.84, height: 0.765 },
thinkpad: { x: 0.07, y: 0.107, width: 0.86, height: 0.805 },
- classic: { x: 0.12, y: 0.155, width: 0.76, height: 0.57 },
- compact: { x: 0.052, y: 0.072, width: 0.896, height: 0.748 },
- edge: { x: 0.05, y: 0.075, width: 0.9, height: 0.85 },
+ // Measured inner glass edges in the 1536×1024 sources, including their
+ // antialiased transition. An inset inside the black glass leaves a second
+ // black frame in the case slices, outside the live desktop.
+ classic: {
+ x: 170 / 1536,
+ y: 144 / 1024,
+ width: 1197 / 1536,
+ height: 617 / 1024,
+ },
+ compact: {
+ x: 70 / 1536,
+ y: 67 / 1024,
+ width: 1398 / 1536,
+ height: 781 / 1024,
+ },
+ edge: { x: 67 / 1536, y: 68 / 1024, width: 1404 / 1536, height: 886 / 1024 },
+};
+// Source openings describe the artwork; target openings reserve less case area
+// without cropping away the original shell, badge or floppy slot.
+const EXPANDED_VIEWPORTS = {
+ classic: { x: 0.065, y: 0.08, width: 0.87, height: 0.76 },
+ compact: { x: 0.04, y: 0.065, width: 0.92, height: 0.8 },
+ edge: { x: 0.025, y: 0.05, width: 0.95, height: 0.9 },
};
function adjacentSkin(
skin: FoldDesktopSkin,
@@ -57,44 +77,80 @@ function adjacentSkin(
export function retroDesktopViewport(
region: LayoutRect,
skin: RetroDesktopSkin = "classic",
+ safeRegion: LayoutRect = region,
+ aspectRatio?: number,
): LayoutRect {
- const inset = VIEWPORTS[skin];
+ const inset =
+ skin === "classic" || skin === "compact" || skin === "edge"
+ ? EXPANDED_VIEWPORTS[skin]
+ : VIEWPORTS[skin];
+ const x = Math.max(safeRegion.x, region.x + region.width * inset.x);
+ const y = Math.max(safeRegion.y, region.y + region.height * inset.y);
+ const available = {
+ x,
+ y,
+ width: Math.max(
+ 0,
+ Math.min(
+ safeRegion.x + safeRegion.width,
+ region.x + region.width * (inset.x + inset.width),
+ ) - x,
+ ),
+ height: Math.max(
+ 0,
+ Math.min(
+ safeRegion.y + safeRegion.height,
+ region.y + region.height * (inset.y + inset.height),
+ ) - y,
+ ),
+ };
+ if (!aspectRatio || !Number.isFinite(aspectRatio) || aspectRatio <= 0)
+ return available;
+ const width = Math.min(available.width, available.height * aspectRatio);
+ const height = width / aspectRatio;
return {
- x: region.x + region.width * inset.x,
- y: region.y + region.height * inset.y,
- width: region.width * inset.width,
- height: region.height * inset.height,
+ x: available.x + (available.width - width) / 2,
+ y: available.y + (available.height - height) / 2,
+ width,
+ height,
};
}
-/** Case material bleeds behind system chrome; only controls use safe geometry. */
-export function FoldDesktopBackdrop({ skin }: { skin: RetroDesktopSkin }) {
- return (
- <View
- pointerEvents="none"
- accessibilityElementsHidden
- importantForAccessibility="no-hide-descendants"
- style={StyleSheet.absoluteFill}
- >
- <Image
- source={
- heritageArtwork(skin)?.palm ?? retroMacArtwork.heritage.macii.palm
- }
- resizeMode="repeat"
- style={styles.artwork}
- />
- </View>
- );
-}
-
/** A non-interactive case around the live desktop; it never replaces the viewer. */
export function FoldDesktopBezel({
region,
skin = "classic",
+ viewport,
}: {
region: LayoutRect;
skin?: RetroDesktopSkin;
+ viewport?: LayoutRect | null;
}) {
+ const source =
+ skin === "compact" || skin === "edge"
+ ? retroMacArtwork[skin]
+ : (heritageArtwork(skin)?.display ?? retroMacArtwork.display);
+ const opening = VIEWPORTS[skin];
+ // Resize the original case around the very same opening used by the viewer.
+ // Nine cropped regions preserve its artwork while fitting any host aspect.
+ const sourceX = [0, opening.x, opening.x + opening.width, 1];
+ const sourceY = [0, opening.y, opening.y + opening.height, 1];
+ const targetX = viewport
+ ? [
+ 0,
+ viewport.x - region.x,
+ viewport.x - region.x + viewport.width,
+ region.width,
+ ]
+ : [];
+ const targetY = viewport
+ ? [
+ 0,
+ viewport.y - region.y,
+ viewport.y - region.y + viewport.height,
+ region.height,
+ ]
+ : [];
return (
<View
pointerEvents="none"
@@ -111,15 +167,44 @@ export function FoldDesktopBezel({
},
]}
>
- <Image
- source={
- skin === "compact" || skin === "edge"
- ? retroMacArtwork[skin]
- : (heritageArtwork(skin)?.display ?? retroMacArtwork.display)
- }
- resizeMode="stretch"
- style={styles.artwork}
- />
+ {viewport ? (
+ [0, 1, 2].flatMap((row) =>
+ [0, 1, 2].map((column) => {
+ const width = targetX[column + 1] - targetX[column];
+ const height = targetY[row + 1] - targetY[row];
+ if (width <= 0 || height <= 0) return null;
+ const imageWidth = width / (sourceX[column + 1] - sourceX[column]);
+ const imageHeight = height / (sourceY[row + 1] - sourceY[row]);
+ return (
+ <View
+ key={`${row}-${column}`}
+ style={{
+ position: "absolute",
+ left: targetX[column],
+ top: targetY[row],
+ width,
+ height,
+ overflow: "hidden",
+ }}
+ >
+ <Image
+ source={source}
+ resizeMode="stretch"
+ style={{
+ position: "absolute",
+ left: -sourceX[column] * imageWidth,
+ top: -sourceY[row] * imageHeight,
+ width: imageWidth,
+ height: imageHeight,
+ }}
+ />
+ </View>
+ );
+ }),
+ )
+ ) : (
+ <Image source={source} resizeMode="stretch" style={styles.artwork} />
+ )}
</View>
);
}
@@ -272,148 +357,199 @@ export function FoldDesktopDeck({
enabled,
skin,
onChange,
+ safeInsets = { top: 0, bottom: 0, left: 0, right: 0 },
+ bottomReserve = 0,
}: {
renderKey(code: string): ReactNode;
send(message: object): void;
enabled: boolean;
skin: RetroDesktopSkin;
onChange(value: FoldDesktopSkin): void;
+ safeInsets?: { top: number; bottom: number; left: number; right: number };
+ bottomReserve?: number;
}) {
const artwork = heritageArtwork(skin);
- if (skin !== "classic")
- return (
- <View testID="remoteDesktop.retroDeck" style={{ flex: 1 }}>
- <View style={{ height: 44 }}>
- <View pointerEvents="none" style={StyleSheet.absoluteFill}>
- <Image
- source={artwork?.rail ?? retroMacArtwork.rail}
- resizeMode="stretch"
- style={styles.artwork}
- />
- </View>
- <FoldDesktopSkinSwitch skin={skin} onChange={onChange} />
+ const darkHardware = skin === "powerbook" || skin === "thinkpad";
+ // These two source images include a narrow white exterior along their
+ // sides. Crop that exterior, keeping the hardware itself edge-to-edge.
+ const deckArtwork = [styles.artwork, darkHardware && styles.darkDeckArtwork];
+ return (
+ <View
+ testID="remoteDesktop.retroDeck"
+ style={{
+ flex: 1,
+ overflow: "hidden",
+ backgroundColor: foldDesktopSkinColors(skin).surface,
+ }}
+ >
+ <View
+ style={{
+ height: 44 + safeInsets.top,
+ paddingTop: safeInsets.top,
+ paddingLeft: safeInsets.left,
+ paddingRight: safeInsets.right,
+ }}
+ >
+ <View pointerEvents="none" style={StyleSheet.absoluteFill}>
+ <Image
+ source={artwork?.rail ?? retroMacArtwork.rail}
+ resizeMode="stretch"
+ style={deckArtwork}
+ />
</View>
- <View style={{ flex: 4, minHeight: 244, overflow: "hidden" }}>
- <View pointerEvents="none" style={StyleSheet.absoluteFill}>
- <Image
- source={artwork?.keys ?? retroMacArtwork.keys}
- resizeMode="stretch"
- style={styles.artwork}
- />
- </View>
- <ScrollView
- style={{
- flex: 1,
- marginHorizontal: artwork ? "5%" : "3.2%",
- marginVertical: 6,
- }}
- contentContainerStyle={{ flexGrow: 1 }}
- bounces={false}
- >
- <FoldDesktopKeys
- renderKey={renderKey}
- fill
- trackpoint={skin === "thinkpad"}
- />
- </ScrollView>
+ <FoldDesktopSkinSwitch skin={skin} onChange={onChange} />
+ </View>
+ <View style={{ flex: 1, minHeight: 0, overflow: "hidden" }}>
+ <View pointerEvents="none" style={StyleSheet.absoluteFill}>
+ <Image
+ source={artwork?.keys ?? retroMacArtwork.keys}
+ resizeMode="stretch"
+ style={deckArtwork}
+ />
</View>
- <View style={{ flex: 1, minHeight: 68 }}>
- <View pointerEvents="none" style={StyleSheet.absoluteFill}>
+ <ScrollView
+ style={{
+ flex: 1,
+ marginHorizontal: artwork ? "5%" : "3.2%",
+ marginVertical: 6,
+ paddingLeft: safeInsets.left,
+ paddingRight: safeInsets.right,
+ }}
+ contentContainerStyle={{ flexGrow: 1 }}
+ bounces={false}
+ >
+ <FoldDesktopKeys
+ renderKey={renderKey}
+ fill
+ trackpoint={skin === "thinkpad"}
+ />
+ </ScrollView>
+ </View>
+ <View style={{ height: 68 + safeInsets.bottom + bottomReserve }}>
+ <View pointerEvents="none" style={StyleSheet.absoluteFill}>
+ <Image
+ source={artwork?.palm ?? retroMacArtwork.pad}
+ resizeMode={artwork ? "cover" : "stretch"}
+ style={styles.artwork}
+ />
+ </View>
+ {artwork && (
+ <View
+ pointerEvents="none"
+ accessibilityElementsHidden
+ importantForAccessibility="no-hide-descendants"
+ style={[
+ StyleSheet.absoluteFill,
+ {
+ alignItems: "center",
+ justifyContent: "center",
+ paddingBottom: safeInsets.bottom + bottomReserve,
+ paddingLeft: safeInsets.left,
+ paddingRight: safeInsets.right,
+ },
+ ]}
+ >
<Image
- source={artwork?.palm ?? retroMacArtwork.pad}
- resizeMode={artwork ? "cover" : "stretch"}
- style={styles.artwork}
+ source={artwork.control}
+ resizeMode="contain"
+ style={{
+ width: skin === "powerbook" ? 66 : 96,
+ height: skin === "powerbook" ? 60 : 44,
+ }}
/>
</View>
- {artwork && (
- <View
- pointerEvents="none"
- accessibilityElementsHidden
- importantForAccessibility="no-hide-descendants"
- style={[
- StyleSheet.absoluteFill,
- { alignItems: "center", justifyContent: "center" },
- ]}
- >
- <Image
- source={artwork.control}
- resizeMode="contain"
- style={{
- width: skin === "powerbook" ? 66 : 96,
- height: skin === "powerbook" ? 60 : 44,
- }}
- />
- </View>
- )}
- <View testID="remoteDesktop.palmrest" style={StyleSheet.absoluteFill}>
- <FoldTouchpad send={send} enabled={enabled} bare />
- </View>
+ )}
+ <View
+ testID="remoteDesktop.palmrest"
+ style={[
+ StyleSheet.absoluteFill,
+ {
+ left: safeInsets.left,
+ right: safeInsets.right,
+ bottom: safeInsets.bottom + bottomReserve,
+ },
+ ]}
+ >
+ <FoldTouchpad send={send} enabled={enabled} bare />
</View>
</View>
- );
- return (
- <View testID="remoteDesktop.retroDeck" style={{ flex: 1 }}>
- <View pointerEvents="none" style={StyleSheet.absoluteFill}>
- <Image
- source={retroMacArtwork.deck}
- resizeMode="stretch"
- style={styles.artwork}
- />
- </View>
- <View style={{ position: "absolute", top: 0, left: 0, right: 0 }}>
- <FoldDesktopSkinSwitch skin={skin} onChange={onChange} />
- </View>
- <ScrollView
- style={{
- position: "absolute",
- left: "9%",
- width: "82%",
- top: "11%",
- height: "53%",
- }}
- bounces={false}
- >
- <FoldDesktopKeys renderKey={renderKey} />
- </ScrollView>
- <View
- style={{
- position: "absolute",
- left: 0,
- right: 0,
- top: "66%",
- bottom: 0,
- }}
- >
- <FoldTouchpad send={send} enabled={enabled} bare />
- </View>
</View>
);
}
export function FoldDesktopKeycap({
skin = "classic",
+ wide = false,
}: {
skin?: FoldDesktopSkin;
+ wide?: boolean;
}) {
+ const source =
+ skin === "powerbook" || skin === "thinkpad"
+ ? retroMacArtwork.darkKeycap
+ : retroMacArtwork.keycap;
+ if (!wide)
+ return (
+ <View pointerEvents="none" style={StyleSheet.absoluteFill}>
+ <Image source={source} resizeMode="stretch" style={styles.artwork} />
+ </View>
+ );
return (
- <View pointerEvents="none" style={StyleSheet.absoluteFill}>
- <Image
- source={
- skin === "powerbook" || skin === "thinkpad"
- ? retroMacArtwork.darkKeycap
- : retroMacArtwork.keycap
- }
- resizeMode="stretch"
- style={styles.artwork}
- />
+ <View
+ pointerEvents="none"
+ style={[StyleSheet.absoluteFill, { flexDirection: "row" }]}
+ >
+ {/* Scale both ends with key height; only the flat middle grows in width.
+ A spacebar must not turn the square key's bevel into a wide wedge. */}
+ <View style={styles.keycapEnd}>
+ <Image
+ source={source}
+ resizeMode="stretch"
+ style={{
+ position: "absolute",
+ left: 0,
+ top: 0,
+ width: "400%",
+ height: "100%",
+ }}
+ />
+ </View>
+ <View style={{ flex: 1, overflow: "hidden" }}>
+ <Image
+ source={source}
+ resizeMode="stretch"
+ style={{
+ position: "absolute",
+ left: "-50%",
+ top: 0,
+ width: "200%",
+ height: "100%",
+ }}
+ />
+ </View>
+ <View style={styles.keycapEnd}>
+ <Image
+ source={source}
+ resizeMode="stretch"
+ style={{
+ position: "absolute",
+ right: 0,
+ top: 0,
+ width: "400%",
+ height: "100%",
+ }}
+ />
+ </View>
</View>
);
}
const styles = StyleSheet.create({
+ darkDeckArtwork: { left: "-2%", width: "104%" },
+ keycapEnd: { height: "100%", aspectRatio: 0.25, overflow: "hidden" },
// Native Image keeps its asset's intrinsic size unless both dimensions are
// explicit; absoluteFill alone does not constrain a bundled bitmap.
- artwork: { ...StyleSheet.absoluteFillObject, width: "100%", height: "100%" },
+ artwork: { ...StyleSheet.absoluteFill, width: "100%", height: "100%" },
legend: {
fontFamily: monoFont,
fontSize: typeScale.caption,
diff --git a/apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx b/apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx
index 8fd0c79584..94f14482e1 100644
--- a/apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx
+++ b/apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx
@@ -4,7 +4,6 @@ import { controlRegion } from "@/platform/windowGeometry";
import { FoldTouchpad } from "./FoldTouchpad";
import {
FoldDesktopBezel,
- FoldDesktopBackdrop,
FoldDesktopDeck,
FoldDesktopKeycap,
FoldDesktopSkinSwitch,
@@ -537,13 +536,13 @@ export function RemoteDesktopSession({
const [backControlHeight, setBackControlHeight] = useState(44);
// On a wide iOS window the status reservation can occupy only the trailing
// corner. Share that row, with the native toolbar's bottom spacing, when the
- // complete back button fits in its unobstructed leading corner.
+ // complete back button fits in its unobstructed leading corner, including
+ // tabletop posture: the fold below does not obstruct this status row.
const sharedBackTop = insets.top - backControlHeight - spacing.md;
const portraitBackLeft = edgePadding.paddingLeft + spacing.lg;
const sharedStatusRow =
Platform.OS === "ios" &&
!landscape &&
- !tableRegion &&
geometry.reservedRegionsSupported &&
geometry.regularWidth &&
statusReservation.length > 0 &&
@@ -575,9 +574,29 @@ export function RemoteDesktopSession({
frameReady &&
!keyboard &&
!operations;
+ // Artwork covers both physical halves, including the division and system
+ // reservations. Only interactive content is constrained to the safe regions.
+ const foldSeam = tableRegion
+ ? (tableRegion.first.y + tableRegion.first.height + tableRegion.second.y) /
+ 2
+ : 0;
+ const hardwareMedia = { x: 0, y: 0, width: geometry.width, height: foldSeam };
+ const hardwareControls = {
+ x: 0,
+ y: foldSeam,
+ width: geometry.width,
+ height: geometry.height - foldSeam,
+ };
const retroViewport =
retroDesktop && foldLayout
- ? retroDesktopViewport(foldLayout.media, foldSkin)
+ ? retroDesktopViewport(
+ hardwareMedia,
+ foldSkin,
+ foldLayout.media,
+ lease && lease.display.height > 0
+ ? lease.display.width / lease.display.height
+ : undefined,
+ )
: null;
const fullScreenFoldBackground = Boolean(foldLayout);
const foldControls = foldLayout?.controls ?? controlRegion(geometry);
@@ -3189,7 +3208,7 @@ export function RemoteDesktopSession({
if (!comboMode) setModifiers([]);
}}
>
- {retro && <FoldDesktopKeycap skin={foldSkin} />}
+ {retro && <FoldDesktopKeycap skin={foldSkin} wide={code === "Space"} />}
<Text
numberOfLines={1}
adjustsFontSizeToFit
@@ -3200,10 +3219,19 @@ export function RemoteDesktopSession({
retro && {
color: foldDesktopSkinColors(foldSkin).textPrimary,
fontWeight: fontWeight.medium,
+ maxWidth: "100%",
+ flexShrink: 1,
+ textAlign: "center",
},
]}
>
- {keyLabel(code)}
+ {retro && code === "MetaLeft" && caps?.platform === "darwin"
+ ? "⌘"
+ : retro && code === "ControlLeft"
+ ? "Ctrl"
+ : retro && code === "Backspace"
+ ? "⌫"
+ : keyLabel(code)}
</Text>
</Pressable>
);
@@ -3229,7 +3257,6 @@ export function RemoteDesktopSession({
style={styles.root}
>
{Platform.OS === "android" && focused && <StatusBar hidden />}
- {retroDesktop && focused && <FoldDesktopBackdrop skin={foldSkin} />}
<View style={[styles.body, landscape && styles.landscape]}>
<View
style={[
@@ -3261,7 +3288,11 @@ export function RemoteDesktopSession({
]}
>
{retroDesktop && focused && foldLayout ? (
- <FoldDesktopBezel region={foldLayout.media} skin={foldSkin} />
+ <FoldDesktopBezel
+ region={hardwareMedia}
+ skin={foldSkin}
+ viewport={retroViewport}
+ />
) : null}
<Animated.View
testID="remoteDesktop.media"
@@ -3650,11 +3681,15 @@ export function RemoteDesktopSession({
testID="remoteDesktop.foldControls"
style={{
position: "absolute",
- left: foldControls.x,
- top: foldControls.y,
- width: foldControls.width,
- height: foldControls.height,
- paddingBottom: toolbarSize.height + (showMouseButtons ? 80 : 0),
+ left: retroDesktop ? hardwareControls.x : foldControls.x,
+ top: retroDesktop ? hardwareControls.y : foldControls.y,
+ width: retroDesktop ? hardwareControls.width : foldControls.width,
+ height: retroDesktop
+ ? hardwareControls.height
+ : foldControls.height,
+ paddingBottom: retroDesktop
+ ? 0
+ : toolbarSize.height + (showMouseButtons ? 80 : 0),
}}
>
{retroDesktop ? (
@@ -3664,6 +3699,19 @@ export function RemoteDesktopSession({
enabled={canInput}
skin={foldSkin}
onChange={setFoldSkin}
+ safeInsets={{
+ top: Math.max(0, foldControls.y - hardwareControls.y),
+ bottom: Math.max(
+ 0,
+ geometry.height - foldControls.y - foldControls.height,
+ ),
+ left: foldControls.x,
+ right: Math.max(
+ 0,
+ geometry.width - foldControls.x - foldControls.width,
+ ),
+ }}
+ bottomReserve={toolbarSize.height + (showMouseButtons ? 80 : 0)}
/>
) : (
<>
@@ -4385,6 +4433,8 @@ const makeStyles = (colors: ThemeColors) =>
retroKey: {
backgroundColor: "transparent",
borderBottomWidth: 0,
+ paddingHorizontal: spacing.sm,
paddingBottom: spacing.xs,
+ overflow: "hidden",
},
});
diff --git a/apps/mobile/src/remote-desktop/__tests__/screen.test.tsx b/apps/mobile/src/remote-desktop/__tests__/screen.test.tsx
index d1ee0f6dde..8678e1c102 100644
--- a/apps/mobile/src/remote-desktop/__tests__/screen.test.tsx
+++ b/apps/mobile/src/remote-desktop/__tests__/screen.test.tsx
@@ -5381,6 +5381,50 @@ describe("remote desktop controls", () => {
}),
);
});
+ // Unit: Duo tabletop must retain the earlier shared-status-row Back position;
+ // existing fold coverage only checked viewer/lease continuity, not this corner.
+ it("keeps tabletop Back beside the status region unless its corner is occluded", () => {
+ fixture.size = { width: 669, height: 951 };
+ fixture.safe = { top: 82, bottom: 34, left: 0, right: 0 };
+ const geometry: WindowGeometry = {
+ ...fixture.size,
+ insets: fixture.safe,
+ regularWidth: true,
+ regularHeight: true,
+ barEdge: "none",
+ reservedRegionsSupported: true,
+ regions: [
+ { kind: "occlusion", x: 539, y: 0, width: 130, height: 82 },
+ { kind: "division", x: 0, y: 455, width: 669, height: 40 },
+ ],
+ };
+ const render = (value: WindowGeometry) => {
+ act(() =>
+ root.render(
+ <GeometryContext.Provider value={value}>
+ <RemoteDesktopScreen />
+ </GeometryContext.Provider>,
+ ),
+ );
+ return Object.assign(
+ {},
+ ...fixture.views["remoteDesktop.backPosition"].style
+ .flat(Infinity)
+ .filter(Boolean),
+ );
+ };
+ expect(render(geometry)).toMatchObject({ top: 26, left: 16 });
+ expect(
+ render({
+ ...geometry,
+ regions: [
+ ...geometry.regions,
+ { kind: "occlusion", x: 0, y: 0, width: 80, height: 82 },
+ ],
+ }).top,
+ ).toBeGreaterThanOrEqual(82);
+ expect(render(geometry)).toMatchObject({ top: 26, left: 16 });
+ });
it("folding and unfolding preserve the viewer and control lease", async () => {
const geometry: WindowGeometry = {
width: 900,
@@ -5541,7 +5585,23 @@ describe("remote desktop controls", () => {
events: [{ kind: "key", code: "KeyA", down: true }],
});
const initialFrame = fixture.views["remoteDesktop.media"].style;
+ // Unit: a physical skin must fit the host's actual aspect, not the Duo
+ // half-screen aspect; switching hardware must not stretch the desktop.
+ const expectHostAspect = () => {
+ const frame = Object.assign(
+ {},
+ ...fixture.views["remoteDesktop.media"].style
+ .flat(Infinity)
+ .filter(Boolean),
+ );
+ expect(
+ (fixture.size.width - frame.left - frame.right) /
+ (fixture.size.height - frame.top - frame.bottom),
+ ).toBeCloseTo(display.width / display.height, 6);
+ };
+ expectHostAspect();
swipe(-100); // Macintosh II → PowerBook: release keys even between retro variants.
+ expectHostAspect();
expect(fixture.views["remoteDesktop.media"].style).not.toEqual(
initialFrame,
);
@@ -5550,6 +5610,7 @@ describe("remote desktop controls", () => {
).not.toBeNull();
expect(sent()).toContainEqual({ type: "releaseInput" });
swipe(-100); // PowerBook → ThinkPad, both retain real input.
+ expectHostAspect();
expect(
host.querySelector('[data-testid="remoteDesktop.retroKeys"]'),
).not.toBeNull();
@@ -5578,11 +5639,14 @@ describe("remote desktop controls", () => {
swipe(100); // PowerBook → Macintosh II restores the same viewport.
expect(fixture.views["remoteDesktop.media"].style).toEqual(initialFrame);
swipe(100); // Macintosh II → edge.
+ expectHostAspect();
expect(fixture.views["remoteDesktop.media"].style).not.toEqual(
initialFrame,
);
swipe(100); // Edge → compact.
+ expectHostAspect();
swipe(100); // Compact → classic.
+ expectHostAspect();
swipe(100); // Classic wraps to modern.
expect(
host.querySelector('[data-testid="remoteDesktop.retroKeys"]'),
diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.md
index a2a9d1fba1..dc41e443ea 100644
--- a/docs/design-rules/DESIGN.md
+++ b/docs/design-rules/DESIGN.md
@@ -730,6 +730,8 @@ The expanded teammate section previews five chats (local teammates, remote teamm
- Prefer the native navigation container for page back/close and toolbar actions. On Duo, let the system adapt navigation to the shared status/toolbar region; only the detail column gets the vertical bar in a split view. Sidebar-local menus stay in the sidebar.
- Full-screen custom overlays (remote desktop) keep back and tools on the right in both Duo landscape rotations, centered on one rail below the system status area. Back comes before tools. Respect safe areas and reserved folds; do not mirror the rail from a video orientation event.
- Portrait tabletop remote desktop on iPhone Duo defaults to the Macintosh II-inspired case and functional keyboard (owner request, 2026-10-24). The lower-pane appearance rail accepts left/right swipes and an accessible tap to cycle directionally through classic, slim classic, full-screen retro, Macintosh II, PowerBook 170, ThinkPad 701C and modern (wrapping at either end), retaining the choice for this viewer. Slim and full-screen variants maximize the viewport and use a nearly full-width keyboard and invisible palmrest pointer surface; retain the original classic as a comparison. Switching between any two appearances releases held input. Pointer gestures cover the entire palmrest below the keys, independently of the much smaller visible touchpad, trackball or buttons; never extend this region over the keyboard or appearance rail. Use photorealistic classic Macintosh-inspired hardware artwork: textured ivory plastic, a deep CRT recess, a floppy slot and beveled keycaps (owner refinement, 2026-10-24). Hardware artwork keeps each model’s material in Light/Dark mode, with Light text tokens on ivory keycaps and Dark text tokens on graphite keycaps. Macintosh II and PowerBook retain their rainbow Apple badge; ThinkPad retains its black material and red TrackPoint. These are space-adapted homages, not mechanically exact replicas; surrounding app chrome follows the active theme. Fit the live viewer within the screen opening. Do not substitute flat CSS/vector panels for the physical material. Keep the live viewer and lease mounted across switches. Unfolded/landscape layouts and system keyboard panels retain their ordinary appearance. Implementation: `apps/mobile/src/remote-desktop/FoldDesktopSkin.tsx` and `RemoteDesktopScreen.tsx`.
+- Duo retro hardware draws the upper display case and lower keyboard deck edge-to-edge across their respective physical halves, meeting at the fold center. Scale the original artwork itself; never fill unsafe strips with a separate texture, tiled background or substitute image. Only the live screen, keyboard and interactive controls respect safe regions and toolbar clearance (owner correction, 2026-10-24).
+- Retain the first three appearances (classic, slim classic, full-screen retro), but apply the same space optimization to all three: enlarged host-aspect screen openings, nearly full-width keys, shared beveled spacebar and bounded legends. This supersedes keeping the classic layout unchanged as a comparison. Reserve the lower safe area and toolbar before allocating keyboard height; a short lower pane scrolls the keys rather than pushing the palmrest outside the screen (owner refinement, 2026-10-24).
- Floating back/menu controls use the shared `navigationChrome.target` size; grouped actions use the same target breadth, without an extra outer padding ring. Use native Liquid Glass (regular for app navigation; clear over immersive remote desktop imagery), circle for a single icon and capsule for a group; do not tint neutral glass with opaque surface colors. Use semantic foregrounds and the existing non-glass fallback in both themes.
- Clear glass over remote imagery follows the navigation theme: dark icons in Light and light icons in Dark. A localized light/dark backing inside the control outline protects contrast, with a matching translucent selected-state fill. Keep the material clear and the desktop outside the controls unchanged. This explicit two-mode palette is Cindy’s design choice; Clear material does not provide automatic foreground adaptation.
- The mobile in-app HTML browser's floating controls sit over arbitrary page content. They keep regular glass and add the translucent `navigationChrome.pageTint` theme tint (70%, never opaque). Untinted regular glass adapts to the page behind it. Over a light page in Dark mode it turned light under light icons. The tint keeps the control polarity aligned with the app theme. The user approved this design on 2026-10-11.