dsh-desktop-windows 0.1.9 → 0.2.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/main.js +16 -4
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.1.9",
4
+ "version": "0.2.0",
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
@@ -439,11 +439,12 @@ function openShotWindow() {
439
439
  })
440
440
  }
441
441
 
442
- /** 选区确认:裁剪 → 剪贴板 → 主窗口粘贴。 */
442
+ /** 选区确认:裁剪 → 剪贴板 → 恢复主窗口并粘贴。 */
443
443
  function onShotDone(rect) {
444
444
  const image = pendingShot
445
445
  pendingShot = null
446
446
  if (shotWindow && !shotWindow.isDestroyed()) shotWindow.destroy()
447
+ showMainWindow() // 恢复显示聊天窗口
447
448
  if (!image || !rect) return
448
449
  const sf = screen.getPrimaryDisplay().scaleFactor || 1
449
450
  const r = {
@@ -472,6 +473,7 @@ function onShotDone(rect) {
472
473
  function onShotCancel() {
473
474
  pendingShot = null
474
475
  if (shotWindow && !shotWindow.isDestroyed()) shotWindow.destroy()
476
+ showMainWindow() // 恢复显示聊天窗口
475
477
  }
476
478
 
477
479
  /* ------------------------------------------------------------------ *
@@ -627,9 +629,12 @@ if (!gotLock) {
627
629
  ipcMain.on('dsh-desktop:reload', () => {
628
630
  if (mainWindow) mainWindow.webContents.reload()
629
631
  })
630
- // 选区截图:截全屏打开选区窗口用户框选 → 裁剪 → 剪贴板 → 粘贴聊天框
632
+ // 选区截图:隐藏主窗口截全屏选区窗口 → 裁剪 → 剪贴板 → 粘贴
631
633
  ipcMain.handle('dsh-desktop:capture', async () => {
632
634
  try {
635
+ // 先隐藏主窗口,避免截到聊天框本身
636
+ if (mainWindow && !mainWindow.isDestroyed()) mainWindow.hide()
637
+ await new Promise((r) => setTimeout(r, 250))
633
638
  const display = screen.getPrimaryDisplay()
634
639
  const sf = display.scaleFactor || 1
635
640
  const sources = await desktopCapturer.getSources({
@@ -639,12 +644,19 @@ if (!gotLock) {
639
644
  height: Math.round(display.size.height * sf),
640
645
  },
641
646
  })
642
- if (!sources.length) return { ok: false, error: '未找到屏幕源' }
647
+ if (!sources.length) {
648
+ showMainWindow()
649
+ return { ok: false, error: '未找到屏幕源' }
650
+ }
643
651
  pendingShot = sources[0].thumbnail
644
- if (pendingShot.isEmpty()) return { ok: false, error: '截图为空' }
652
+ if (pendingShot.isEmpty()) {
653
+ showMainWindow()
654
+ return { ok: false, error: '截图为空' }
655
+ }
645
656
  openShotWindow()
646
657
  return { ok: true }
647
658
  } catch (e) {
659
+ showMainWindow()
648
660
  return { ok: false, error: String((e && e.message) || e) }
649
661
  }
650
662
  })