dsh-desktop-windows 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/main.js +13 -2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-desktop-windows",
3
3
  "productName": "DeepSeek Harness Desktop",
4
- "version": "0.2.1",
4
+ "version": "0.2.2",
5
5
  "description": "DeepSeek Harness 桌面版(Windows)· Electron desktop shell for DeepSeek Harness (dsh web) — 双击即用,无需终端 / double-click to run the harness in a standalone window",
6
6
  "main": "src/main.js",
7
7
  "license": "MIT",
package/src/main.js CHANGED
@@ -410,11 +410,17 @@ function openShotWindow() {
410
410
  shotWindow.focus()
411
411
  return
412
412
  }
413
+ // 用显示器精确尺寸铺满屏幕(不用 fullscreen,Windows 上更可靠)
414
+ const display = screen.getPrimaryDisplay()
415
+ const bounds = display.bounds
413
416
  shotWindow = new BrowserWindow({
417
+ x: bounds.x,
418
+ y: bounds.y,
419
+ width: bounds.width,
420
+ height: bounds.height,
414
421
  frame: false,
415
422
  resizable: false,
416
423
  movable: false,
417
- fullscreen: true,
418
424
  alwaysOnTop: true,
419
425
  skipTaskbar: true,
420
426
  show: false, // 截图加载完成后再显示,避免黑屏闪烁
@@ -426,6 +432,7 @@ function openShotWindow() {
426
432
  },
427
433
  })
428
434
  shotWindow.setAlwaysOnTop(true, 'screen-saver')
435
+ shotWindow.setBounds(bounds) // 再次确保铺满
429
436
  shotWindow.loadFile(path.join(__dirname, 'screenshot.html'))
430
437
  shotWindow.webContents.once('did-finish-load', () => {
431
438
  if (pendingShot && !shotWindow.isDestroyed()) {
@@ -461,8 +468,12 @@ function onShotDone(rect) {
461
468
  }
462
469
  if (r.width <= 0 || r.height <= 0) return
463
470
  const cropped = image.crop(r)
471
+ // 保存一份临时文件(验证/诊断用)
472
+ try {
473
+ fs.writeFileSync(path.join(os.tmpdir(), 'dsh-screenshot.png'), cropped.toPNG())
474
+ } catch { /* 非致命 */ }
464
475
  clipboard.writeImage(cropped)
465
- // 等主窗口就绪后再聚焦输入框并粘贴(失败则提示手动 Ctrl+V
476
+ // 等主窗口就绪后尝试自动粘贴;若聚焦失败则提示手动 Ctrl+V
466
477
  if (mainWindow && !mainWindow.isDestroyed()) {
467
478
  setTimeout(async () => {
468
479
  let focused = false