dsh-chat-collapse: One-Click Collapse Plugin for DSH Web GUI Chat Components

DSH adopts an “everything is a plugin” architecture, allowing functionality to be extended without modifying the core code. In the DSH Web GUI, the chat component is the core of interaction, but the persistent input box and toolbar occupy a significant amount of vertical space, causing the conversation content to be compressed. The dsh-chat-collapse plugin provides a non-invasive solution: it hides the component by adding a collapse button to the input box’s toolbar row and brings up a restore ball from the corner, thereby freeing up space.

Plugin Positioning

This is a DSH Web GUI plugin maintained by cx2002302-lang. It runs purely on the browser side, without patching the core, injecting bundles, or starting host services, fully aligning with DSH’s plugin philosophy.

Core Features

  1. One-click Collapse and Restore
    Click the button on the far right of the input box’s toolbar row to collapse the chat component, releasing vertical space. After collapsing, a restore ball floats in the corner of the viewport; clicking it restores the component. When the component is collapsed, drafts, pasted images, and cursor positions are all preserved.

  2. Target Switching
    By default, it only collapses the input box area. By right-clicking the restore ball, you can switch the collapse target between “Input Box” and “Entire Conversation Area”.

  3. Shortcuts and Persistence
    Supports the Alt+H keyboard shortcut to toggle the collapsed/expanded state. The state is persisted via localStorage['dsh.chatCollapse.v1'] and remains after refreshing the page.

  4. Privacy and Security
    The plugin has no network requests, no telemetry, and no host services. The only disk write operation is for local storage of state data; it does not touch conversation content or read draft text.

Installation and Activation

Please ensure the DSH version is not lower than 0.1.2-rc.1 before installing.

  1. Install the plugin:
    dsh plugin --profile web add github:cx2002302-lang/dsh-chat-collapse
  1. After installation, you need to restart the DSH Web service to load the new plugin (according to the README example):
    systemctl --user restart dsh-web.service
  1. After restarting and refreshing the page, a collapse button will appear on the far right of the input box’s toolbar row.

Typical Usage

  • Collapse Component: Click the button on the far right of the input box’s toolbar row.
  • Restore Component: Click the restore ball floating in the corner.
  • Keyboard Toggle: Press Alt+H.
  • Switch Collapse Target: In the collapsed state, right-click the restore ball and select the target.

Technical Details

  • Dependency Hooks: The plugin relies on literal attribute hooks in the official source code, including [data-composer-card], [data-composer-seat], and [data-conversation-scroll].
  • Implementation: By setting the data-dsh-cc and data-dsh-cc-target attributes on the <html> element and driving visibility with CSS selectors. This approach avoids using class names, preventing style loss during React re-renders.

Uninstallation

If you need to remove the plugin:

dsh plugin --profile web remove dsh-chat-collapse

Uninstallation automatically cleans up injected styles, buttons, the restore ball, and HTML attributes, leaving no residue.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye