跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

0032-vz-offscreen-login-view.patch

31 行 · 1.2 KB历史下载
1--- a/pkg/driver/vz/vz_driver_darwin.go
2+++ b/pkg/driver/vz/vz_driver_darwin.go
3@@ -536,8 +536,15 @@
4 return errCh, nil
5 }
6
7+// OffscreenView lets an embedding application service a user-authorized login
8+// view without opening Lima's VM window. The application must bind the exact instance.
9+var OffscreenView func(ctx context.Context, machine *vz.VirtualMachine, instanceDir string) error
10+var OwnsOffscreenView func(instanceDir string) bool
11+
12 func (l *LimaVzDriver) canRunGUI() bool {
13 switch *l.Instance.Config.Video.Display {
14+ case "offscreen":
15+ return *l.Instance.Config.OS == limatype.DARWIN && OffscreenView != nil && OwnsOffscreenView != nil && OwnsOffscreenView(l.Instance.Dir)
16 case "vz", "default":
17 return true
18 default:
19@@ -545,8 +552,11 @@
20 }
21 }
22
23-func (l *LimaVzDriver) RunGUI(_ context.Context) error {
24+func (l *LimaVzDriver) RunGUI(ctx context.Context) error {
25 if l.canRunGUI() {
26+ if *l.Instance.Config.Video.Display == "offscreen" {
27+ return OffscreenView(ctx, l.machine.VirtualMachine, l.Instance.Dir)
28+ }
29 title := fmt.Sprintf("Lima: %s", l.Instance.Name)
30 return l.machine.StartGraphicApplication(1920, 1200, vz.WithWindowTitle(title))
31 }