dsh-gufa-code 1.2.4 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -67,16 +67,18 @@ dsh plugin add dsh-gufa-code
67
67
  - **会话弹窗里可以直接切换工作区**:点弹窗右上角的工作区名,选任意工作区后下方会话列表随之切换,点会话即打开(IDE 项目同时切到该工作区),不用再先切左侧工作区;
68
68
  - 会话里的文件链接、diff 标签页属于 DSH 右侧栏,被覆盖层挡住时点「打开完整对话」即可查看。
69
69
 
70
- ### 桌面悬浮层(实验功能,macOS arm64)
71
-
72
- - IDE 标题栏点「显示器」图标 → 屏幕上出现一个**无边框、半透明(0.55)、永远置顶**的独立悬浮窗,里面就是古法编程;
73
- - 顶部 22px 拖动条移动窗口,窗口大小/位置会记住;
74
- - 菜单栏「古法」图标:
75
- - **跟随 App 窗口…**:选一个正在运行的 App 窗口,悬浮层自动对齐并实时跟随它的位置/大小(需要授予「屏幕录制」权限——只读窗口尺寸,不录屏);
76
- - **停止跟随**:恢复自由拖动;
77
- - **切换点击穿透**:穿透后鼠标直接操作下层 App;
78
- - **关闭悬浮层**。
79
- - 限制:目前仅 macOS arm64;跟随多显示器时按主屏坐标换算;helper 未签名(本地 ad-hoc 签名),分发前需要正式签名/notarize。
70
+ ### 摸鱼模式 / 桌面悬浮层(实验功能,macOS arm64)
71
+
72
+ - **进入摸鱼**:IDE 标题栏点「显示器」图标 → 弹出 **App 窗口列表**(图标 + App 名 + 窗口标题 + 窗口尺寸,和投屏列表类似)→ 选中一个窗口,古法编程会:
73
+ - 把该 App 切到前台(主窗口自动被盖住,等于「隐藏主窗口」);
74
+ - 以**无边框、半透明(0.55)、永远置顶**的独立悬浮窗出现,并**自动吸附**到该窗口:位置、大小完全一致,窗口移动/缩放时实时跟随。
75
+ - **悬浮层交互**:
76
+ - 顶部 22px 拖动条移动窗口(右键 = 摸鱼菜单),窗口大小/位置会记住;
77
+ - 全局快捷键 **⌃⌥⌘G**:切换点击穿透(穿透后鼠标直接操作下面的 App,再按一次切回来);
78
+ - 菜单栏「古法」图标 / 拖动条右键:**退出摸鱼**(关闭悬浮层并把主窗口唤回前台);
79
+ - 在悬浮层里再点「显示器」图标 = 退出摸鱼。
80
+ - 选择器底部还有「自由悬浮(不吸附)」:不绑定窗口,自己拖拽缩放。
81
+ - 限制:目前仅 macOS arm64;多显示器按主屏坐标换算;helper 未正式签名(本地 ad-hoc 签名),分发前需要签名/notarize。
80
82
 
81
83
  ### 外观
82
84
 
package/client.js CHANGED
@@ -1122,6 +1122,24 @@ html[data-gufa-ide] [role="dialog"] {
1122
1122
  .gufa-session-group-count{font-size:10.5px;opacity:.6;font-variant-numeric:tabular-nums}
1123
1123
  .gufa-session-group[data-current] .gufa-session-group-head{color:var(--gufa-text)}
1124
1124
  .gufa-session-group .gufa-session-row{margin-left:10px}
1125
+ /* 摸鱼模式:App 窗口选择器 */
1126
+ .gufa-float-backdrop{position:fixed;inset:0;z-index:2147483200;display:flex;align-items:center;justify-content:center;
1127
+ background:rgba(0,0,0,0.42);padding:24px;box-sizing:border-box}
1128
+ .gufa-float-picker{width:min(660px,92vw);max-height:min(640px,82vh);display:flex;flex-direction:column;
1129
+ background:var(--gufa-layer);border:1px solid var(--gufa-border-strong);border-radius:12px;overflow:hidden;
1130
+ box-shadow:0 24px 60px rgba(0,0,0,0.45)}
1131
+ .gufa-float-list{display:flex;flex-direction:column;gap:4px;padding:8px 10px;overflow:auto;min-height:120px}
1132
+ .gufa-float-row{display:flex;align-items:center;gap:10px;width:100%;padding:7px 10px;border:0;border-radius:9px;
1133
+ background:transparent;color:var(--gufa-text);font:inherit;text-align:left;cursor:pointer}
1134
+ .gufa-float-row:hover{background:var(--gufa-hover)}
1135
+ .gufa-float-row:disabled{opacity:0.55;cursor:default}
1136
+ .gufa-float-icon{width:26px;height:26px;object-fit:contain;flex:0 0 auto;border-radius:5px}
1137
+ .gufa-float-meta{display:flex;flex-direction:column;gap:1px;min-width:0;flex:1 1 auto}
1138
+ .gufa-float-owner{font-size:12.5px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1139
+ .gufa-float-title{font-size:11px;color:var(--gufa-text-dim);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1140
+ .gufa-float-size{flex:0 0 auto;font-size:10.5px;color:var(--gufa-text-dim);font-variant-numeric:tabular-nums}
1141
+ .gufa-float-permission{padding:16px}
1142
+ .gufa-float-permission-title{font-size:13px;font-weight:600;margin-bottom:6px}
1125
1143
  .gufa-session-workspace-btn{display:inline-flex;align-items:center;gap:4px;border:1px solid var(--gufa-border);background:var(--gufa-layer2);
1126
1144
  color:var(--gufa-text-dim);border-radius:7px;padding:2px 8px;font:inherit;font-size:11.5px;cursor:pointer;max-width:260px}
1127
1145
  .gufa-session-workspace-btn:hover{background:var(--gufa-hover);color:var(--gufa-text)}
@@ -9436,6 +9454,8 @@ G.GufaApp = function GufaApp(props) {
9436
9454
  const [sessionsOpen, setSessionsOpen] = useState(false)
9437
9455
  const [floatRunning, setFloatRunning] = useState(false)
9438
9456
  const [floatBusy, setFloatBusy] = useState(false)
9457
+ /* 摸鱼窗口选择器:null | {status:'loading'|'ready'|'permission'|'error', windows:[], error:''} */
9458
+ const [floatPicker, setFloatPicker] = useState(null)
9439
9459
  /* 会话弹窗里选中的工作区(null = 跟随当前 IDE 项目) */
9440
9460
  const [sessionWorkspacePath, setSessionWorkspacePath] = useState(null)
9441
9461
  const [sessionWorkspacePicker, setSessionWorkspacePicker] = useState(false)
@@ -10108,25 +10128,78 @@ G.GufaApp = function GufaApp(props) {
10108
10128
  return () => { cancelled = true }
10109
10129
  }, [])
10110
10130
 
10111
- const toggleFloatWindow = useCallback(async () => {
10131
+ /* 退出摸鱼:关掉悬浮层(helper 会把主窗口唤回前台) */
10132
+ const stopFloatWindow = useCallback(async () => {
10112
10133
  if (floatBusy) return
10113
10134
  setFloatBusy(true)
10114
10135
  try {
10115
- if (floatRunning) {
10116
- await G.api('float.stop')
10117
- setFloatRunning(false)
10118
- setBanner('悬浮层已关闭')
10136
+ await G.api('float.stop')
10137
+ setFloatRunning(false)
10138
+ setBanner('已退出摸鱼:主窗口已恢复')
10139
+ } catch (error) {
10140
+ setBanner(G.errorText(error))
10141
+ } finally {
10142
+ setFloatBusy(false)
10143
+ }
10144
+ }, [floatBusy])
10145
+
10146
+ /* 拉取可吸附的 App 窗口列表(摸鱼列表) */
10147
+ const openFloatPicker = useCallback(async () => {
10148
+ if (floatBusy) return
10149
+ setFloatPicker({ status: 'loading', windows: [], error: '' })
10150
+ try {
10151
+ const value = await G.api('float.windows')
10152
+ if (value?.ok === true && Array.isArray(value.windows)) {
10153
+ setFloatPicker({ status: 'ready', windows: value.windows, error: '' })
10154
+ } else if (value?.ok === false && value?.permission === 'screen-recording') {
10155
+ setFloatPicker({ status: 'permission', windows: [], error: '' })
10119
10156
  } else {
10120
- const value = await G.api('float.start')
10121
- setFloatRunning(value?.running === true)
10122
- setBanner('悬浮层已启动:屏幕上的半透明窗口,菜单栏「古法」可切换点击穿透')
10157
+ setFloatPicker({ status: 'error', windows: [], error: '没有读到可吸附的窗口' })
10123
10158
  }
10159
+ } catch (error) {
10160
+ setFloatPicker({ status: 'error', windows: [], error: G.errorText(error) })
10161
+ }
10162
+ }, [floatBusy])
10163
+
10164
+ /* 选中某个 App 窗口 → 启动悬浮层并吸附它 */
10165
+ const startFloatForWindow = useCallback(async (target) => {
10166
+ if (floatBusy || target === null || target === undefined) return
10167
+ setFloatBusy(true)
10168
+ try {
10169
+ const value = await G.api('float.start', {
10170
+ follow: { windowNumber: Number(target.windowNumber) || 0, pid: Number(target.pid) || 0 },
10171
+ })
10172
+ setFloatRunning(value?.running === true)
10173
+ setFloatPicker(null)
10174
+ const name = typeof target.owner === 'string' && target.owner !== '' ? target.owner : '所选窗口'
10175
+ setBanner(`摸鱼模式已开启:已吸附 ${name};⌃⌥⌘G 切换点击穿透,菜单栏「古法」可退出`)
10124
10176
  } catch (error) {
10125
10177
  setBanner(G.errorText(error))
10126
10178
  } finally {
10127
10179
  setFloatBusy(false)
10128
10180
  }
10129
- }, [floatBusy, floatRunning])
10181
+ }, [floatBusy])
10182
+
10183
+ /* 自由悬浮(不吸附窗口) */
10184
+ const startFloatFree = useCallback(async () => {
10185
+ if (floatBusy) return
10186
+ setFloatBusy(true)
10187
+ try {
10188
+ const value = await G.api('float.start')
10189
+ setFloatRunning(value?.running === true)
10190
+ setFloatPicker(null)
10191
+ setBanner('悬浮层已启动(自由悬浮)')
10192
+ } catch (error) {
10193
+ setBanner(G.errorText(error))
10194
+ } finally {
10195
+ setFloatBusy(false)
10196
+ }
10197
+ }, [floatBusy])
10198
+
10199
+ const toggleFloatWindow = useCallback(() => {
10200
+ if (floatRequested === true || floatRunning) void stopFloatWindow()
10201
+ else void openFloatPicker()
10202
+ }, [floatRequested, floatRunning, stopFloatWindow, openFloatPicker])
10130
10203
 
10131
10204
  /* ── 右侧 AI 面板与当前工作区保持一致 ─────────────────────────────────
10132
10205
  * ChatDock 停靠的是 DSH「主视图会话」,但主视图会话可能属于别的工作区
@@ -11038,7 +11111,7 @@ G.GufaApp = function GufaApp(props) {
11038
11111
  }, h(G.Icon, { name: 'image', size: 16 }))
11039
11112
  : null,
11040
11113
  h(G.IconButton, {
11041
- title: floatRunning ? '关闭桌面悬浮层' : '打开桌面悬浮层(半透明置顶窗口)',
11114
+ title: floatRequested === true || floatRunning ? '退出摸鱼(关闭悬浮层,回主窗口)' : '进入摸鱼模式:选择一个 App 吸附并悬浮',
11042
11115
  'data-active': floatRunning ? '' : undefined,
11043
11116
  disabled: floatBusy,
11044
11117
  onClick: () => void toggleFloatWindow(),
@@ -11364,6 +11437,80 @@ G.GufaApp = function GufaApp(props) {
11364
11437
  ),
11365
11438
  /* 弹窗 */
11366
11439
  modal === null ? null : renderModal(),
11440
+ floatPicker !== null
11441
+ ? h(
11442
+ 'div',
11443
+ {
11444
+ className: 'gufa-float-backdrop',
11445
+ onMouseDown: (event) => { if (event.target === event.currentTarget) setFloatPicker(null) },
11446
+ },
11447
+ h(
11448
+ 'div',
11449
+ { className: 'gufa-float-picker', role: 'dialog', 'aria-modal': 'true', 'aria-label': '选择要摸鱼的 App' },
11450
+ h(
11451
+ 'div',
11452
+ { className: 'gufa-modal-head' },
11453
+ h(G.Icon, { name: 'monitor', size: 15 }),
11454
+ h('span', { style: { flex: '1 1 auto' } }, '摸鱼模式:选择要吸附的 App'),
11455
+ h(G.IconButton, { title: t('common.close'), onClick: () => setFloatPicker(null) }, h(G.Icon, { name: 'close', size: 14 })),
11456
+ ),
11457
+ floatPicker.status === 'loading'
11458
+ ? h('div', { className: 'gufa-graph-loading', style: { height: 90 } }, h(G.Spinner), '正在读取窗口列表…')
11459
+ : floatPicker.status === 'permission'
11460
+ ? h(
11461
+ 'div',
11462
+ { className: 'gufa-float-permission' },
11463
+ h('div', { className: 'gufa-float-permission-title' }, '需要「屏幕录制」权限'),
11464
+ h('div', { className: 'gufa-hint' }, '摸鱼模式需要读取其他 App 窗口的尺寸(只读尺寸,不录屏)。请在「系统设置 → 隐私与安全性 → 屏幕录制」里允许 DeepSeek Harness / gufa-float,然后点重试。'),
11465
+ h(
11466
+ 'div',
11467
+ { className: 'gufa-row', style: { gap: 8, marginTop: 12 } },
11468
+ h(G.Button, { primary: true, onClick: () => void G.api('float.openPrivacy').catch(() => {}) }, '打开系统设置'),
11469
+ h(G.Button, { onClick: () => void openFloatPicker() }, '重试'),
11470
+ ),
11471
+ )
11472
+ : floatPicker.status === 'error'
11473
+ ? h('div', { className: 'gufa-float-permission' }, h('div', { className: 'gufa-error-banner' }, floatPicker.error))
11474
+ : floatPicker.windows.length === 0
11475
+ ? h('div', { className: 'gufa-hint', style: { padding: 16 } }, '没有可吸附的窗口')
11476
+ : h(
11477
+ 'div',
11478
+ { className: 'gufa-float-list gufa-scroll' },
11479
+ floatPicker.windows.map((win, index) =>
11480
+ h(
11481
+ 'button',
11482
+ {
11483
+ key: `${win.pid}:${win.windowNumber}:${index}`,
11484
+ type: 'button',
11485
+ className: 'gufa-float-row',
11486
+ title: `${win.owner} — ${win.title}`,
11487
+ disabled: floatBusy,
11488
+ onClick: () => void startFloatForWindow(win),
11489
+ },
11490
+ win.icon !== undefined && win.icon !== ''
11491
+ ? h('img', { className: 'gufa-float-icon', src: `data:image/png;base64,${win.icon}`, alt: '' })
11492
+ : h(G.Icon, { name: 'monitor', size: 26 }),
11493
+ h(
11494
+ 'span',
11495
+ { className: 'gufa-float-meta' },
11496
+ h('span', { className: 'gufa-float-owner' }, win.owner !== '' ? win.owner : '未知 App'),
11497
+ h('span', { className: 'gufa-float-title' }, win.title !== '' ? win.title : '(无标题窗口)'),
11498
+ ),
11499
+ h('span', { className: 'gufa-float-size' }, `${Math.round(win.width)}×${Math.round(win.height)}`),
11500
+ ),
11501
+ ),
11502
+ ),
11503
+ h(
11504
+ 'div',
11505
+ { className: 'gufa-modal-foot' },
11506
+ h(G.IconButton, { title: '刷新列表', onClick: () => void openFloatPicker() }, h(G.Icon, { name: 'refresh', size: 14 })),
11507
+ h('span', { style: { flex: '1 1 auto' } }),
11508
+ h(G.Button, { onClick: () => void startFloatFree() }, '自由悬浮(不吸附)'),
11509
+ h(G.Button, { onClick: () => setFloatPicker(null) }, t('common.close')),
11510
+ ),
11511
+ ),
11512
+ )
11513
+ : null,
11367
11514
  sessionsOpen ? renderSessionsDialog() : null,
11368
11515
  shortcutsOpen ? renderShortcutsDialog() : null,
11369
11516
  )
@@ -13,9 +13,13 @@
13
13
  #import <WebKit/WebKit.h>
14
14
  #import <CoreGraphics/CoreGraphics.h>
15
15
  #import <Carbon/Carbon.h>
16
+ #import <signal.h>
16
17
 
17
18
  static const EventHotKeyID GufaToggleHotKey = {'gufa', 1};
18
19
 
20
+ /* SIGTERM 时先把主窗口(DeepSeek Harness)唤回前台,再退出,实现「退出摸鱼」 */
21
+ static void GufaInstallTermHandler(void);
22
+
19
23
  @class GufaAppDelegate;
20
24
 
21
25
  static OSStatus GufaHotKeyHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData);
@@ -34,7 +38,7 @@ static OSStatus GufaHotKeyHandler(EventHandlerCallRef nextHandler, EventRef even
34
38
  NSFontAttributeName: [NSFont systemFontOfSize:10 weight:NSFontWeightMedium],
35
39
  NSForegroundColorAttributeName: [NSColor colorWithCalibratedWhite:1.0 alpha:0.6],
36
40
  };
37
- NSString *label = @"古法编程 · 悬浮层(拖动移动 · 右键菜单 · ⌥⌘G 切穿透)";
41
+ NSString *label = @"古法编程 · 摸鱼中(拖动移动 · 右键菜单 · ⌃⌥⌘G 切穿透)";
38
42
  NSSize size = [label sizeWithAttributes:attrs];
39
43
  NSPoint origin = NSMakePoint(floor((self.bounds.size.width - size.width) / 2.0), floor((self.bounds.size.height - size.height) / 2.0));
40
44
  [label drawAtPoint:origin withAttributes:attrs];
@@ -86,6 +90,10 @@ static OSStatus GufaHotKeyHandler(EventHandlerCallRef nextHandler, EventRef even
86
90
  @property (nonatomic, strong) NSMutableArray<NSDictionary *> *windowCandidates;
87
91
  - (void)loadWebContent;
88
92
  - (void)registerToggleHotKey;
93
+ - (void)activateTargetApp;
94
+ - (void)beginningFollowFromOptions;
95
+ - (void)exitMoyu:(id)sender;
96
+ - (void)restoreMainWindow;
89
97
  - (void)toggleClickThrough:(id)sender;
90
98
  - (void)resetFrame:(id)sender;
91
99
  - (void)quitApp:(id)sender;
@@ -114,9 +122,36 @@ static OSStatus GufaHotKeyHandler(EventHandlerCallRef nextHandler, EventRef even
114
122
  [self buildWindow];
115
123
  [self buildStatusItem];
116
124
  [self registerToggleHotKey];
125
+ [self activateTargetApp];
126
+ [self beginningFollowFromOptions];
117
127
  [self loadWebContent];
118
128
  }
119
129
 
130
+ /** 吸附目标 App:把它切到前台,主窗口就自然被盖住了(等价于「隐藏主窗口」的观感)。 */
131
+ - (void)activateTargetApp {
132
+ NSDictionary *follow = self.options[@"follow"];
133
+ NSNumber *pid = [follow isKindOfClass:[NSDictionary class]] ? follow[@"pid"] : nil;
134
+ if (![pid isKindOfClass:[NSNumber class]]) return;
135
+ NSRunningApplication *app = [NSRunningApplication runningApplicationWithProcessIdentifier:(pid_t)pid.intValue];
136
+ if (app == nil) return;
137
+ [app activateWithOptions:NSApplicationActivateAllWindows];
138
+ }
139
+
140
+ /** 启动就进入「吸附跟随」模式(摸鱼列表选好窗口后直接启动)。 */
141
+ - (void)beginningFollowFromOptions {
142
+ NSDictionary *follow = self.options[@"follow"];
143
+ if (![follow isKindOfClass:[NSDictionary class]]) return;
144
+ NSNumber *number = follow[@"windowNumber"];
145
+ NSNumber *pid = follow[@"pid"];
146
+ if (![number isKindOfClass:[NSNumber class]] || ![pid isKindOfClass:[NSNumber class]]) return;
147
+ self.followWindowNumber = number.intValue;
148
+ self.followOwnerPID = (pid_t)pid.intValue;
149
+ self.following = YES;
150
+ [self startFollowTimer];
151
+ [self applyFollowFrame];
152
+ self.statusItem.button.title = @"古法·摸鱼";
153
+ }
154
+
120
155
  - (void)parseOptions {
121
156
  NSArray<NSString *> *args = NSProcessInfo.processInfo.arguments;
122
157
  if (args.count < 2) return;
@@ -199,10 +234,10 @@ static OSStatus GufaHotKeyHandler(EventHandlerCallRef nextHandler, EventRef even
199
234
  [menu addItemWithTitle:@"跟随 App 窗口…(需屏幕录制权限)" action:@selector(chooseFollowWindow:) keyEquivalent:@""].target = self;
200
235
  [menu addItemWithTitle:@"停止跟随" action:@selector(stopFollow:) keyEquivalent:@""].target = self;
201
236
  [menu addItem:[NSMenuItem separatorItem]];
202
- [menu addItemWithTitle:@"切换点击穿透(⌥⌘G)" action:@selector(toggleClickThrough:) keyEquivalent:@""].target = self;
237
+ [menu addItemWithTitle:@"切换点击穿透(⌃⌥⌘G)" action:@selector(toggleClickThrough:) keyEquivalent:@""].target = self;
203
238
  [menu addItemWithTitle:@"重置窗口位置和大小" action:@selector(resetFrame:) keyEquivalent:@""].target = self;
204
239
  [menu addItem:[NSMenuItem separatorItem]];
205
- [menu addItemWithTitle:@"关闭悬浮层" action:@selector(quitApp:) keyEquivalent:@""].target = self;
240
+ [menu addItemWithTitle:@"退出摸鱼(关闭悬浮层,回主窗口)" action:@selector(exitMoyu:) keyEquivalent:@""].target = self;
206
241
  self.mainMenu = menu;
207
242
  self.statusItem.menu = menu;
208
243
  /* buildWindow 先于 buildStatusItem 执行,这里补挂右键菜单 */
@@ -381,11 +416,11 @@ static OSStatus GufaHotKeyHandler(EventHandlerCallRef nextHandler, EventRef even
381
416
  [self saveFrame];
382
417
  }
383
418
 
384
- /* 全局快捷键 ⌥⌘G:穿透后窗口收不到鼠标事件,靠它切回来(Carbon 热键不需要辅助功能权限) */
419
+ /* 全局快捷键 ⌃⌥⌘G(四键,避免冲突):穿透后窗口收不到鼠标事件,靠它切回来(Carbon 热键不需要辅助功能权限) */
385
420
  - (void)registerToggleHotKey {
386
421
  EventTypeSpec spec = {kEventClassKeyboard, kEventHotKeyPressed};
387
422
  InstallApplicationEventHandler(NewEventHandlerUPP(GufaHotKeyHandler), 1, &spec, (__bridge void *)self, NULL);
388
- RegisterEventHotKey(kVK_ANSI_G, cmdKey | optionKey, GufaToggleHotKey, GetApplicationEventTarget(), 0, &_hotKeyRef);
423
+ RegisterEventHotKey(kVK_ANSI_G, controlKey | optionKey | cmdKey, GufaToggleHotKey, GetApplicationEventTarget(), 0, &_hotKeyRef);
389
424
  }
390
425
 
391
426
  - (void)toggleClickThrough:(id)sender {
@@ -405,16 +440,39 @@ static OSStatus GufaHotKeyHandler(EventHandlerCallRef nextHandler, EventRef even
405
440
  [self saveFrame];
406
441
  }
407
442
 
408
- - (void)quitApp:(id)sender {
443
+ /* 退出摸鱼:恢复主窗口(DeepSeek Harness)到前台,然后关掉悬浮层 */
444
+ - (void)exitMoyu:(id)sender {
445
+ [self restoreMainWindow];
409
446
  [self stopFollowTimer];
410
447
  [self saveFrame];
411
448
  [NSApp terminate:nil];
412
449
  }
413
450
 
451
+ - (void)restoreMainWindow {
452
+ NSArray<NSRunningApplication *> *apps = [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.deepseek.dsh"];
453
+ for (NSRunningApplication *app in apps) {
454
+ [app activateWithOptions:NSApplicationActivateAllWindows];
455
+ }
456
+ }
457
+
414
458
  - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender { return YES; }
415
459
 
416
460
  @end
417
461
 
462
+ /* SIGTERM(Host 的 float.stop)→ 先恢复主窗口再退出,避免「摸鱼退出后主窗口不在前台」 */
463
+ static void GufaInstallTermHandler(void) {
464
+ signal(SIGTERM, SIG_IGN);
465
+ dispatch_source_t source = dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGTERM, 0, dispatch_get_main_queue());
466
+ dispatch_source_set_event_handler(source, ^{
467
+ NSArray<NSRunningApplication *> *apps = [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.deepseek.dsh"];
468
+ for (NSRunningApplication *app in apps) {
469
+ [app activateWithOptions:NSApplicationActivateAllWindows];
470
+ }
471
+ [NSApp terminate:nil];
472
+ });
473
+ dispatch_resume(source);
474
+ }
475
+
418
476
  static OSStatus GufaHotKeyHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData) {
419
477
  (void)nextHandler;
420
478
  (void)event;
@@ -423,8 +481,93 @@ static OSStatus GufaHotKeyHandler(EventHandlerCallRef nextHandler, EventRef even
423
481
  return noErr;
424
482
  }
425
483
 
484
+ /* ── 窗口列表模式:gufa-float --list-windows ─────────────────────── */
485
+
486
+ static NSArray<NSDictionary *> *GufaEnumerateWindows(void) {
487
+ NSMutableArray<NSDictionary *> *rows = [NSMutableArray array];
488
+ CFArrayRef list = CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements, kCGNullWindowID);
489
+ if (list == NULL) return rows;
490
+ NSInteger count = CFArrayGetCount(list);
491
+ pid_t selfPid = NSProcessInfo.processInfo.processIdentifier;
492
+ NSMutableDictionary<NSNumber *, NSData *> *iconCache = [NSMutableDictionary dictionary];
493
+ for (NSInteger i = 0; i < count && rows.count < 60; i++) {
494
+ NSDictionary *info = (__bridge NSDictionary *)CFArrayGetValueAtIndex(list, i);
495
+ NSNumber *layer = info[(id)kCGWindowLayer];
496
+ if (![layer isKindOfClass:[NSNumber class]] || layer.intValue != 0) continue;
497
+ NSNumber *pid = info[(id)kCGWindowOwnerPID];
498
+ if (![pid isKindOfClass:[NSNumber class]] || pid.intValue == selfPid) continue;
499
+ NSNumber *number = info[(id)kCGWindowNumber];
500
+ NSDictionary *bounds = info[(id)kCGWindowBounds];
501
+ if (number == nil || bounds == nil) continue;
502
+ CGRect rect = CGRectZero;
503
+ if (!CGRectMakeWithDictionaryRepresentation((__bridge CFDictionaryRef)bounds, &rect)) continue;
504
+ if (rect.size.width < 200 || rect.size.height < 140) continue;
505
+ NSString *owner = info[(id)kCGWindowOwnerName];
506
+ NSString *title = info[(id)kCGWindowName];
507
+ NSData *iconData = iconCache[pid];
508
+ if (iconData == nil) {
509
+ iconData = NSData.data;
510
+ NSRunningApplication *app = [NSRunningApplication runningApplicationWithProcessIdentifier:(pid_t)pid.intValue];
511
+ NSImage *icon = app.icon;
512
+ if (icon != nil) {
513
+ NSImage *resized = [[NSImage alloc] initWithSize:NSMakeSize(32, 32)];
514
+ [resized lockFocus];
515
+ [icon drawInRect:NSMakeRect(0, 0, 32, 32) fromRect:NSZeroRect operation:NSCompositingOperationCopy fraction:1.0 respectFlipped:YES hints:nil];
516
+ [resized unlockFocus];
517
+ NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] initWithData:resized.TIFFRepresentation];
518
+ NSData *png = [rep representationUsingType:NSBitmapImageFileTypePNG properties:@{}];
519
+ if (png != nil) iconData = png;
520
+ }
521
+ iconCache[pid] = iconData;
522
+ }
523
+ [rows addObject:@{
524
+ @"windowNumber": number,
525
+ @"pid": pid,
526
+ @"owner": owner != nil ? owner : @"",
527
+ @"title": title != nil ? title : @"",
528
+ @"width": @(rect.size.width),
529
+ @"height": @(rect.size.height),
530
+ @"icon": [iconData base64EncodedStringWithOptions:0] ?: @"",
531
+ }];
532
+ }
533
+ CFRelease(list);
534
+ return rows;
535
+ }
536
+
537
+ static int GufaListWindowsMode(void) {
538
+ BOOL granted = CGPreflightScreenCaptureAccess();
539
+ if (!granted) {
540
+ CGRequestScreenCaptureAccess();
541
+ NSDictionary *out = @{@"ok": @NO, @"permission": @"screen-recording"};
542
+ NSData *json = [NSJSONSerialization dataWithJSONObject:out options:0 error:NULL];
543
+ fwrite(json.bytes, 1, json.length, stdout);
544
+ fputc('\n', stdout);
545
+ return 2;
546
+ }
547
+ NSArray<NSDictionary *> *rows = GufaEnumerateWindows();
548
+ if (rows.count == 0) {
549
+ /* CGRequestScreenCaptureAccess 授权后同一进程内可能还需要重启;提示前端重试 */
550
+ NSDictionary *out = @{@"ok": @NO, @"permission": @"screen-recording"};
551
+ NSData *json = [NSJSONSerialization dataWithJSONObject:out options:0 error:NULL];
552
+ fwrite(json.bytes, 1, json.length, stdout);
553
+ fputc('\n', stdout);
554
+ return 2;
555
+ }
556
+ NSDictionary *out = @{@"ok": @YES, @"windows": rows};
557
+ NSData *json = [NSJSONSerialization dataWithJSONObject:out options:0 error:NULL];
558
+ fwrite(json.bytes, 1, json.length, stdout);
559
+ fputc('\n', stdout);
560
+ return 0;
561
+ }
562
+
426
563
  int main(int argc, const char *argv[]) {
564
+ if (argc > 1 && strcmp(argv[1], "--list-windows") == 0) {
565
+ @autoreleasepool {
566
+ return GufaListWindowsMode();
567
+ }
568
+ }
427
569
  @autoreleasepool {
570
+ GufaInstallTermHandler();
428
571
  [NSApplication sharedApplication];
429
572
  [NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory];
430
573
  GufaAppDelegate *delegate = [[GufaAppDelegate alloc] init];
package/host/dev.js CHANGED
@@ -3,7 +3,8 @@
3
3
  * 旧版本 Host(没有本方法)会让 api('dev.version') 返回 not-found,客户端据此提示重启 Harness。
4
4
  */
5
5
  import { appendFileSync, existsSync } from 'node:fs'
6
- import { spawn } from 'node:child_process'
6
+ import { execFile, spawn } from 'node:child_process'
7
+ import { promisify } from 'node:util'
7
8
  import { dirname, join } from 'node:path'
8
9
  import { fileURLToPath } from 'node:url'
9
10
  import { ApiError } from './context.js'
@@ -12,6 +13,7 @@ const DEBUG_LOG_PATH = '/tmp/gufa-code-debug.log'
12
13
  const PLUGIN_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..')
13
14
  /* 悬浮层子进程放在 globalThis:host 模块热重载后仍能持有同一个句柄 */
14
15
  const floatState = globalThis.__gufaFloatState ?? (globalThis.__gufaFloatState = { child: null, startedAt: 0 })
16
+ const runFile = promisify(execFile)
15
17
 
16
18
  /** 查找当前平台编译好的悬浮层 helper(P0 只支持 macOS)。 */
17
19
  function floatBinaryPath() {
@@ -50,11 +52,59 @@ export function register(router, env) {
50
52
  binary: floatBinaryPath(),
51
53
  }))
52
54
 
53
- router.method('float.start', async () => {
55
+ /** 列出可吸附的 App 窗口(spawn helper 的 --list-windows 模式,JSON 输出)。 */
56
+ router.method('float.windows', async () => {
57
+ if (process.platform !== 'darwin') throw new ApiError('unsupported', '摸鱼模式目前只支持 macOS', 400)
58
+ const binary = floatBinaryPath()
59
+ if (binary === null) throw new ApiError('missing-helper', '悬浮层程序未构建,请先运行 scripts/build-float-macos.sh', 500)
60
+ let stdout = ''
61
+ try {
62
+ const result = await runFile(binary, ['--list-windows'], { timeout: 10_000, maxBuffer: 8 * 1024 * 1024 })
63
+ stdout = String(result.stdout ?? '')
64
+ } catch (error) {
65
+ stdout = String(error && error.stdout || '')
66
+ }
67
+ const line = stdout.trim().split('\n').filter(Boolean).pop() ?? ''
68
+ let parsed = null
69
+ try {
70
+ parsed = JSON.parse(line)
71
+ } catch {
72
+ parsed = null
73
+ }
74
+ if (parsed === null) throw new ApiError('list-failed', '读取窗口列表失败(helper 无输出)', 500)
75
+ return parsed
76
+ })
77
+
78
+ router.method('float.openPrivacy', async () => {
79
+ if (process.platform !== 'darwin') return { ok: false }
80
+ try {
81
+ spawn('open', ['x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture'], { detached: true, stdio: 'ignore' }).unref()
82
+ return { ok: true }
83
+ } catch {
84
+ return { ok: false }
85
+ }
86
+ })
87
+
88
+ router.method('float.start', async (body) => {
54
89
  if (process.platform !== 'darwin') throw new ApiError('unsupported', '桌面悬浮层目前只支持 macOS', 400)
55
90
  const binary = floatBinaryPath()
56
91
  if (binary === null) throw new ApiError('missing-helper', '悬浮层程序未构建,请先运行 scripts/build-float-macos.sh', 500)
57
- if (floatRunning()) return { running: true, pid: floatState.child.pid }
92
+ const follow = body !== null && typeof body === 'object' && body.follow !== null && typeof body.follow === 'object'
93
+ ? { windowNumber: Number(body.follow.windowNumber) || 0, pid: Number(body.follow.pid) || 0 }
94
+ : null
95
+ if (follow !== null && follow.windowNumber > 0) {
96
+ /* 切换摸鱼目标:先关掉旧悬浮层再起一个新的 */
97
+ if (floatRunning()) {
98
+ try {
99
+ floatState.child.kill('SIGTERM')
100
+ } catch {
101
+ /* ignore */
102
+ }
103
+ await new Promise((resolve) => setTimeout(resolve, 500))
104
+ }
105
+ } else if (floatRunning()) {
106
+ return { running: true, pid: floatState.child.pid }
107
+ }
58
108
  let webServer
59
109
  let connection
60
110
  try {
@@ -68,7 +118,7 @@ export function register(router, env) {
68
118
  }
69
119
  const base = `${webServer.protocol}//127.0.0.1:${String(webServer.port)}`
70
120
  const authUrl = connection.authenticatedUrl(`${base}/`)
71
- const payload = JSON.stringify({ authUrl, appUrl: `${base}/` })
121
+ const payload = JSON.stringify({ authUrl, appUrl: `${base}/`, follow: follow !== null && follow.windowNumber > 0 ? follow : undefined })
72
122
  let child
73
123
  try {
74
124
  child = spawn(binary, [payload], { detached: true, stdio: 'ignore' })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-gufa-code",
3
- "version": "1.2.4",
3
+ "version": "1.3.0",
4
4
  "description": "古法编程 · AI 辅助:一键把 DSH 主面板变成 VS Code 风格 IDE(Monaco 编辑器、文件树、Git、SSH、真实终端 + 右侧官方会话);主张亲手写、每个改动心中有数,AI 是助理、你是第一责任人",
5
5
  "icon": "icon.svg",
6
6
  "keywords": [
@@ -1114,6 +1114,24 @@ html[data-gufa-ide] [role="dialog"] {
1114
1114
  .gufa-session-group-count{font-size:10.5px;opacity:.6;font-variant-numeric:tabular-nums}
1115
1115
  .gufa-session-group[data-current] .gufa-session-group-head{color:var(--gufa-text)}
1116
1116
  .gufa-session-group .gufa-session-row{margin-left:10px}
1117
+ /* 摸鱼模式:App 窗口选择器 */
1118
+ .gufa-float-backdrop{position:fixed;inset:0;z-index:2147483200;display:flex;align-items:center;justify-content:center;
1119
+ background:rgba(0,0,0,0.42);padding:24px;box-sizing:border-box}
1120
+ .gufa-float-picker{width:min(660px,92vw);max-height:min(640px,82vh);display:flex;flex-direction:column;
1121
+ background:var(--gufa-layer);border:1px solid var(--gufa-border-strong);border-radius:12px;overflow:hidden;
1122
+ box-shadow:0 24px 60px rgba(0,0,0,0.45)}
1123
+ .gufa-float-list{display:flex;flex-direction:column;gap:4px;padding:8px 10px;overflow:auto;min-height:120px}
1124
+ .gufa-float-row{display:flex;align-items:center;gap:10px;width:100%;padding:7px 10px;border:0;border-radius:9px;
1125
+ background:transparent;color:var(--gufa-text);font:inherit;text-align:left;cursor:pointer}
1126
+ .gufa-float-row:hover{background:var(--gufa-hover)}
1127
+ .gufa-float-row:disabled{opacity:0.55;cursor:default}
1128
+ .gufa-float-icon{width:26px;height:26px;object-fit:contain;flex:0 0 auto;border-radius:5px}
1129
+ .gufa-float-meta{display:flex;flex-direction:column;gap:1px;min-width:0;flex:1 1 auto}
1130
+ .gufa-float-owner{font-size:12.5px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1131
+ .gufa-float-title{font-size:11px;color:var(--gufa-text-dim);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1132
+ .gufa-float-size{flex:0 0 auto;font-size:10.5px;color:var(--gufa-text-dim);font-variant-numeric:tabular-nums}
1133
+ .gufa-float-permission{padding:16px}
1134
+ .gufa-float-permission-title{font-size:13px;font-weight:600;margin-bottom:6px}
1117
1135
  .gufa-session-workspace-btn{display:inline-flex;align-items:center;gap:4px;border:1px solid var(--gufa-border);background:var(--gufa-layer2);
1118
1136
  color:var(--gufa-text-dim);border-radius:7px;padding:2px 8px;font:inherit;font-size:11.5px;cursor:pointer;max-width:260px}
1119
1137
  .gufa-session-workspace-btn:hover{background:var(--gufa-hover);color:var(--gufa-text)}
@@ -157,6 +157,8 @@ G.GufaApp = function GufaApp(props) {
157
157
  const [sessionsOpen, setSessionsOpen] = useState(false)
158
158
  const [floatRunning, setFloatRunning] = useState(false)
159
159
  const [floatBusy, setFloatBusy] = useState(false)
160
+ /* 摸鱼窗口选择器:null | {status:'loading'|'ready'|'permission'|'error', windows:[], error:''} */
161
+ const [floatPicker, setFloatPicker] = useState(null)
160
162
  /* 会话弹窗里选中的工作区(null = 跟随当前 IDE 项目) */
161
163
  const [sessionWorkspacePath, setSessionWorkspacePath] = useState(null)
162
164
  const [sessionWorkspacePicker, setSessionWorkspacePicker] = useState(false)
@@ -829,25 +831,78 @@ G.GufaApp = function GufaApp(props) {
829
831
  return () => { cancelled = true }
830
832
  }, [])
831
833
 
832
- const toggleFloatWindow = useCallback(async () => {
834
+ /* 退出摸鱼:关掉悬浮层(helper 会把主窗口唤回前台) */
835
+ const stopFloatWindow = useCallback(async () => {
833
836
  if (floatBusy) return
834
837
  setFloatBusy(true)
835
838
  try {
836
- if (floatRunning) {
837
- await G.api('float.stop')
838
- setFloatRunning(false)
839
- setBanner('悬浮层已关闭')
839
+ await G.api('float.stop')
840
+ setFloatRunning(false)
841
+ setBanner('已退出摸鱼:主窗口已恢复')
842
+ } catch (error) {
843
+ setBanner(G.errorText(error))
844
+ } finally {
845
+ setFloatBusy(false)
846
+ }
847
+ }, [floatBusy])
848
+
849
+ /* 拉取可吸附的 App 窗口列表(摸鱼列表) */
850
+ const openFloatPicker = useCallback(async () => {
851
+ if (floatBusy) return
852
+ setFloatPicker({ status: 'loading', windows: [], error: '' })
853
+ try {
854
+ const value = await G.api('float.windows')
855
+ if (value?.ok === true && Array.isArray(value.windows)) {
856
+ setFloatPicker({ status: 'ready', windows: value.windows, error: '' })
857
+ } else if (value?.ok === false && value?.permission === 'screen-recording') {
858
+ setFloatPicker({ status: 'permission', windows: [], error: '' })
840
859
  } else {
841
- const value = await G.api('float.start')
842
- setFloatRunning(value?.running === true)
843
- setBanner('悬浮层已启动:屏幕上的半透明窗口,菜单栏「古法」可切换点击穿透')
860
+ setFloatPicker({ status: 'error', windows: [], error: '没有读到可吸附的窗口' })
844
861
  }
862
+ } catch (error) {
863
+ setFloatPicker({ status: 'error', windows: [], error: G.errorText(error) })
864
+ }
865
+ }, [floatBusy])
866
+
867
+ /* 选中某个 App 窗口 → 启动悬浮层并吸附它 */
868
+ const startFloatForWindow = useCallback(async (target) => {
869
+ if (floatBusy || target === null || target === undefined) return
870
+ setFloatBusy(true)
871
+ try {
872
+ const value = await G.api('float.start', {
873
+ follow: { windowNumber: Number(target.windowNumber) || 0, pid: Number(target.pid) || 0 },
874
+ })
875
+ setFloatRunning(value?.running === true)
876
+ setFloatPicker(null)
877
+ const name = typeof target.owner === 'string' && target.owner !== '' ? target.owner : '所选窗口'
878
+ setBanner(`摸鱼模式已开启:已吸附 ${name};⌃⌥⌘G 切换点击穿透,菜单栏「古法」可退出`)
879
+ } catch (error) {
880
+ setBanner(G.errorText(error))
881
+ } finally {
882
+ setFloatBusy(false)
883
+ }
884
+ }, [floatBusy])
885
+
886
+ /* 自由悬浮(不吸附窗口) */
887
+ const startFloatFree = useCallback(async () => {
888
+ if (floatBusy) return
889
+ setFloatBusy(true)
890
+ try {
891
+ const value = await G.api('float.start')
892
+ setFloatRunning(value?.running === true)
893
+ setFloatPicker(null)
894
+ setBanner('悬浮层已启动(自由悬浮)')
845
895
  } catch (error) {
846
896
  setBanner(G.errorText(error))
847
897
  } finally {
848
898
  setFloatBusy(false)
849
899
  }
850
- }, [floatBusy, floatRunning])
900
+ }, [floatBusy])
901
+
902
+ const toggleFloatWindow = useCallback(() => {
903
+ if (floatRequested === true || floatRunning) void stopFloatWindow()
904
+ else void openFloatPicker()
905
+ }, [floatRequested, floatRunning, stopFloatWindow, openFloatPicker])
851
906
 
852
907
  /* ── 右侧 AI 面板与当前工作区保持一致 ─────────────────────────────────
853
908
  * ChatDock 停靠的是 DSH「主视图会话」,但主视图会话可能属于别的工作区
@@ -1759,7 +1814,7 @@ G.GufaApp = function GufaApp(props) {
1759
1814
  }, h(G.Icon, { name: 'image', size: 16 }))
1760
1815
  : null,
1761
1816
  h(G.IconButton, {
1762
- title: floatRunning ? '关闭桌面悬浮层' : '打开桌面悬浮层(半透明置顶窗口)',
1817
+ title: floatRequested === true || floatRunning ? '退出摸鱼(关闭悬浮层,回主窗口)' : '进入摸鱼模式:选择一个 App 吸附并悬浮',
1763
1818
  'data-active': floatRunning ? '' : undefined,
1764
1819
  disabled: floatBusy,
1765
1820
  onClick: () => void toggleFloatWindow(),
@@ -2085,6 +2140,80 @@ G.GufaApp = function GufaApp(props) {
2085
2140
  ),
2086
2141
  /* 弹窗 */
2087
2142
  modal === null ? null : renderModal(),
2143
+ floatPicker !== null
2144
+ ? h(
2145
+ 'div',
2146
+ {
2147
+ className: 'gufa-float-backdrop',
2148
+ onMouseDown: (event) => { if (event.target === event.currentTarget) setFloatPicker(null) },
2149
+ },
2150
+ h(
2151
+ 'div',
2152
+ { className: 'gufa-float-picker', role: 'dialog', 'aria-modal': 'true', 'aria-label': '选择要摸鱼的 App' },
2153
+ h(
2154
+ 'div',
2155
+ { className: 'gufa-modal-head' },
2156
+ h(G.Icon, { name: 'monitor', size: 15 }),
2157
+ h('span', { style: { flex: '1 1 auto' } }, '摸鱼模式:选择要吸附的 App'),
2158
+ h(G.IconButton, { title: t('common.close'), onClick: () => setFloatPicker(null) }, h(G.Icon, { name: 'close', size: 14 })),
2159
+ ),
2160
+ floatPicker.status === 'loading'
2161
+ ? h('div', { className: 'gufa-graph-loading', style: { height: 90 } }, h(G.Spinner), '正在读取窗口列表…')
2162
+ : floatPicker.status === 'permission'
2163
+ ? h(
2164
+ 'div',
2165
+ { className: 'gufa-float-permission' },
2166
+ h('div', { className: 'gufa-float-permission-title' }, '需要「屏幕录制」权限'),
2167
+ h('div', { className: 'gufa-hint' }, '摸鱼模式需要读取其他 App 窗口的尺寸(只读尺寸,不录屏)。请在「系统设置 → 隐私与安全性 → 屏幕录制」里允许 DeepSeek Harness / gufa-float,然后点重试。'),
2168
+ h(
2169
+ 'div',
2170
+ { className: 'gufa-row', style: { gap: 8, marginTop: 12 } },
2171
+ h(G.Button, { primary: true, onClick: () => void G.api('float.openPrivacy').catch(() => {}) }, '打开系统设置'),
2172
+ h(G.Button, { onClick: () => void openFloatPicker() }, '重试'),
2173
+ ),
2174
+ )
2175
+ : floatPicker.status === 'error'
2176
+ ? h('div', { className: 'gufa-float-permission' }, h('div', { className: 'gufa-error-banner' }, floatPicker.error))
2177
+ : floatPicker.windows.length === 0
2178
+ ? h('div', { className: 'gufa-hint', style: { padding: 16 } }, '没有可吸附的窗口')
2179
+ : h(
2180
+ 'div',
2181
+ { className: 'gufa-float-list gufa-scroll' },
2182
+ floatPicker.windows.map((win, index) =>
2183
+ h(
2184
+ 'button',
2185
+ {
2186
+ key: `${win.pid}:${win.windowNumber}:${index}`,
2187
+ type: 'button',
2188
+ className: 'gufa-float-row',
2189
+ title: `${win.owner} — ${win.title}`,
2190
+ disabled: floatBusy,
2191
+ onClick: () => void startFloatForWindow(win),
2192
+ },
2193
+ win.icon !== undefined && win.icon !== ''
2194
+ ? h('img', { className: 'gufa-float-icon', src: `data:image/png;base64,${win.icon}`, alt: '' })
2195
+ : h(G.Icon, { name: 'monitor', size: 26 }),
2196
+ h(
2197
+ 'span',
2198
+ { className: 'gufa-float-meta' },
2199
+ h('span', { className: 'gufa-float-owner' }, win.owner !== '' ? win.owner : '未知 App'),
2200
+ h('span', { className: 'gufa-float-title' }, win.title !== '' ? win.title : '(无标题窗口)'),
2201
+ ),
2202
+ h('span', { className: 'gufa-float-size' }, `${Math.round(win.width)}×${Math.round(win.height)}`),
2203
+ ),
2204
+ ),
2205
+ ),
2206
+ h(
2207
+ 'div',
2208
+ { className: 'gufa-modal-foot' },
2209
+ h(G.IconButton, { title: '刷新列表', onClick: () => void openFloatPicker() }, h(G.Icon, { name: 'refresh', size: 14 })),
2210
+ h('span', { style: { flex: '1 1 auto' } }),
2211
+ h(G.Button, { onClick: () => void startFloatFree() }, '自由悬浮(不吸附)'),
2212
+ h(G.Button, { onClick: () => setFloatPicker(null) }, t('common.close')),
2213
+ ),
2214
+ ),
2215
+ )
2216
+ : null,
2088
2217
  sessionsOpen ? renderSessionsDialog() : null,
2089
2218
  shortcutsOpen ? renderShortcutsDialog() : null,
2090
2219
  )