Sessions & Messages

dsh-float-window

imkingjh999/dsh-float-window · ★ 0

imkingjh999

Shared floating-window shell for DSH web plugins: float/dock/minimize, drag, edge-snap, corner resize, per-win

License
MIT
Added
2026-08-23
Maintenance
active
Install kind
github
npm
dsh-float-window

No manifest check is available; listing does not imply compatibility or security review.

安装

dsh plugin --profile web add github:imkingjh999/dsh-float-window

GitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试

For install and environment setup, plus plugin development tutorials, see DSH community docs ↗

README

Source README · body: en · Read Chinese README

Table of contents
  1. Features
  2. Usage
  3. Multi-window detection & boss-key assignment (≥0.2)
  4. License

Shared floating-window shell for DSH web plugins — one React component giving every DeepSeek Harness plugin the same window behavior: dsh-shorts-wall and dsh-deepsea both render through it.

中文 | English

Features

Feature Detail
Three window states Float (drag / snap to edge), dock rail, minimized
Corner resize nw/ne/sw/se anchored on the opposite corner; both modes share one rectangle — docking snaps flush right (0.4.1)
Minimize memory Remembers the pre-minimize mode and dock-open state
Window controls Title-bar ─ minimize / □ maximize icon buttons;
minimizing IS the boss-key action — the tooltip shows the live combo
(e.g. "Alt+X Minimize")
One-click maximize Title-bar button fills the viewport (8px margin);
the normal rectangle is kept intact so toggling back restores exactly;
dragging a maximized window restores it under the pointer; persists
Boss key Default Alt+S; multiple windows get distinct combos automatically
Multi-window coexistence Two z bands, offset launcher slots, raise-on-restore, per-window boss keys
Content never remounts Mode switches only re-style the container; the subtree stays mounted
Fully configurable title / accent / glyph / bounds / default mode / every label is a prop

Usage

Source package (consumers inline it with tsdown; react is a peerDependency):

import { FloatWindow } from 'dsh-float-window'

<FloatWindow
  storageKey="my-plugin:shell"   // geometry/mode persistence key
  title="My Window"
  accent="#7fc4ff"
  launcherGlyph="🪟"
  labels={{
    openTitle: 'Open window',
    expandTitle: 'Expand',
    minimizeTitle: 'Minimize (boss key restores)',
    modeToggleTip: 'Toggle float / dock',
    floatText: 'float',
    bossKeyText: 'Boss key {key}',  // optional; {key} substitutes the live combo
  }}
>
  {(visible, ctx) => <YourContent visible={visible} bossKey={ctx.bossKey} />}
</FloatWindow>

Requires React 18+ (peer) and a bundler-style TypeScript resolution (tsdown/vite/tsc moduleResolution: bundler).

Multi-window detection & boss-key assignment (≥0.2)

Every plugin client bundles its own copy of this component, so coordination rides the window.__dshFloatWindows global registry:

  • Detection: floatWindowSnapshot() lists the windows mounted in the document and the combo each answers to; the same registry drives z stacking and the bottom-right launcher offsets (bottom: 18 + n×52).
  • Auto-assignment: windows without a declared key take combos from the pool Alt+S → Alt+X → Alt+Z → Alt+C → Alt+V → Alt+B → Alt+Q → Alt+W in mount order (Alt+D/E/F are skipped — Chrome reserves them), then Alt+Shift+1…. A lone window behaves exactly like 0.1 (Alt+S).
  • Declared keys: a bossKey="Alt+D" combo is reserved — auto windows never land on it, and an auto window sitting on it yields and refreshes its hints. Two windows declaring the same combo both respond, as asked.
  • Full control: an isBossKey predicate without a bossKey keeps the anonymous 0.1 behaviour — no coordination, hint degrades to "Boss key".
  • Live hints: launcher and dock-rail tooltips, plus the bossKeyText label (supports the {key} placeholder), always show the combo the window currently answers to.

Note: coordination requires every window in the page to run ≥0.2 (0.1 instances do not register and keep defaulting to Alt+S).

License

MIT