Zum Hauptinhalt springen
H

dsh-window-pin

hakuno410/dsh-window-pin

A pushpin in the session header that keeps the Windows desktop window above every other window; clicking it again releases the window, and the choice is restored on the next launch. The same switch is exposed to the agent as the window_pin tool with pin, unpin, toggle and status actions. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.

Installation

dsh plugin --profile web add github:hakuno410/dsh-window-pin

README

dsh-window-pin

A pushpin button for DeepSeek Harness Desktop that keeps the window above every other window — the same idea as the pin in WeChat's title bar.

中文说明

A pushpin highlighted in the session header

What it does

  • One pushpin button in the session header's right-hand utilities (next to the schedule, terminal and subagent icons).
  • Click once: the window stays on top, and the pin fills in with the theme's accent colour.
  • Click again: back to a normal window.
  • The choice is remembered in ~/.dsh/window-pin/state.json and restored on the next launch.

The same switch is exposed to the agent as the window_pin tool, so you can just ask:

window_pin(action="pin" | "unpin" | "toggle" | "status")

Both the button and the tool call one Host method — there is no second copy of the logic.

Install

From this folder (Plugins → Add plugin → point at the directory):

Plugins → Add plugin → /path/to/dsh-window-pin

From git:

git clone https://github.com/<you>/dsh-window-pin
# then Plugins → Add plugin → pick the cloned folder

Restart Desktop after installing: the Host half loads with the process.

Requirements: Windows 10/11 and the Desktop app. PowerShell 5.1 (shipped with Windows) is used for the Win32 call.

How it works

The Desktop shell runs with titleBarStyle: "hidden" and a 40 px native overlay for the window controls; it has no seat for extra window chrome, and Electron's renderer cannot touch the OS window. So the toggle goes straight to Win32:

  1. helper.ps1 is started once and kept warm. It compiles the SetWindowPos / GetWindowLong P/Invoke table a single time.
  2. The target is the largest visible top-level window owned by the Desktop shell process.
  3. Every call ends by reading WS_EX_TOPMOST back, so the reported state is the window's real state rather than an assumption.
  4. Flags are SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE, so neither position nor focus changes.

Latency: the first call after start-up pays the interpreter warm-up (~1.4 s), every later call is a few milliseconds.

GET  /api/window-pin/state     → { ok, supported, topmost }
POST /api/window-pin/set       → { ok, topmost }   body: { "on": true }
POST /api/window-pin/toggle    → { ok, topmost }

Limits

  • Windows only. Other platforms hide the button; the tool answers that it is unavailable.
  • With several Desktop windows open, the largest one is the one that gets pinned.
  • The button lives in the session header, so it appears once a session is open.
  • Pinning does not survive a Windows Explorer restart (SetWindowPos is per window handle); reopen the app and it is restored from the saved preference.

Layout

PathRole
index.jsHost half: routes, the window_pin tool, the warm helper process, saved preference
client.jsClient half: the header button and its state
helper.ps1Win32 line-protocol helper (status / on / off / toggle / quit)
cordis.patch.ymlBundle patch that inserts the window-pin row
locale/Plugin Manager title, description and detail document

License

MIT


中文说明

给 DeepSeek Harness 桌面版加一个图钉,点一下让窗口钉在所有窗口最上层,再点一次取消——和微信标题栏那个图钉一个意思。

用起来

会话标题栏右侧那排图标里(时间表 / 终端 / 子代理那一组)多一个图钉:

  • 点一下 → 窗口保持最前,图钉变实心、染主题色
  • 再点一下 → 取消,图钉变回空心
  • 悬停会说明当前动作;切换失败会自动弹回原状态

置顶状态记在 ~/.dsh/window-pin/state.json,重启 DSH 会自动恢复。

同一个开关也开成了 agent 工具,直接说"把窗口置顶"就行:

window_pin(action="pin" | "unpin" | "toggle" | "status")

安装

插件 → 添加插件 → 指向这个文件夹;装完重启一次 DSH(host 半要随进程加载)。

原理

桌面壳是 titleBarStyle: hidden + 40px 原生按钮区,没给窗口层留插槽,所以直接走 Win32:

  • helper.ps1 常驻,P/Invoke 表只编译一次
  • 认窗口:桌面壳进程里最大的可见顶层窗口
  • 每次操作后用 GetWindowLong(GWL_EXSTYLE) 反查 WS_EX_TOPMOST,返回的是真实状态
  • SWP_NOACTIVATE,不抢焦点、不动位置

首次调用约 1.4 秒(编译 P/Invoke),之后每次几毫秒。

限制

只在 Windows 桌面版可用;多开时认最大的那个窗口;按钮在会话标题栏里,所以要开着会话才看得到。

许可

MIT

Ähnliche Plugins