Preface¶
When running full-screen TUIs or long-running output through DeepSeek Harness (DSH), the terminal in the right sidebar reloads xterm and replays the screen snapshot every time you switch tabs or sessions, causing white flashes and jank. This happens because the docking kit does not declare keepMounted for the terminal tab type, so the terminal body is unmounted when hidden.
This article introduces a client-side plugin that keeps the right-sidebar terminal mounted across tab switches. When you switch back, the terminal continues where it left off—no rebuild, no replay.
Plugin Profile¶
- Name:
dsh-terminal-keepalive - Maintainer: lesliejackson
- Repository: https://github.com/lesliejackson/dsh-terminal-keepalive
- Category: Client
- Stars: 0
- Version: 1.0.1
- License: MIT
It targets only the terminal tab type in the DSH right sidebar. It does not alter themes, keybindings, terminal close behavior, or Agent terminal tooling.
Core Features¶
- When a tab is hidden, the terminal component stays mounted and the xterm instance is not destroyed.
- While hidden, if no new output arrives, the existing connection is maintained. If new output does arrive, the client-side output connection is paused while the Host PTY continues running.
- When the tab becomes visible again, the Host snapshot is synced to the still-mounted xterm instance to restore the session.
The implementation is split into a browser-side half (client.js) and a Host-side half (index.js). The Host side is inert and exists only so the bundle can carry the client plugin. The browser side wraps the official terminal tab component, enables keepMounted once the wrapper is active, and removes the wrapper (restoring the original flag) when deactivated.
Installation & Activation¶
In a development directory:
- Plugins → Add Plugin → Local Directory, and select this directory; or
dsh plugin --profile desktop add "file:<absolute-path-to-this-dir>"
On other machines:
- Use the tarball in
dist/, e.g.dsh plugin add "…/local-dsh-terminal-keepalive-1.0.1.tgz"; or - Install from the Git URL.
After installation, simply refresh the page. No app restart is needed, and there are no configuration options to set.
Typical Usage¶
- Open the right-sidebar terminal and wait for output to stop.
- Switch to the Files tab or another session, then switch back to the terminal. Verify that the screen content and scroll position are preserved.
- Let the terminal produce continuous output, switch away, and come back. Confirm the process is still running and the screen is synced to the latest output.
- Close the terminal tab and verify the Host process terminates cleanly.
Use Cases & Caveats¶
- Ideal for developers who frequently switch tabs while using full-screen TUIs (
claude,codebuddy,vim) or reviewing long-running output. - The plugin runs with the permissions of the current DSH process. Review the source code and license before installing.
- A hidden terminal still retains its xterm instance and view, consuming the corresponding amount of memory. A brief
connectingstate may appear when switching back, and the Host snapshot may shift the original scroll position. keepMountedis a per-type (e.g.,terminal) boolean in the public API. There is no way to keep only “the last” terminal tab alive; per-instance limits would require upstream dockkit support.- The plugin relies on
sidebarRightTabs’skeepMounted,slotssame-key priority, and the official terminal view’smountcleanup callback. - It only affects the
terminaltab type in the right sidebar. The bottom workbench terminal indsh-better-sidebaris a separate implementation and is not affected.
Summary¶
This plugin keeps the DSH right-sidebar terminal mounted across tab switches, eliminating xterm rebuilds and screen snapshot replays, and reducing white flashes and jank. It is well suited for developers who switch between tabs and sessions frequently.
- Plugin directory: https://www.skillhub.cn/plugins/lesliejackson/dsh-terminal-keepalive
- Repository: https://github.com/lesliejackson/dsh-terminal-keepalive