DSH’s design philosophy is “Everything is a plugin.” When developing with DSH Web, the default interface is relatively plain and lacks distinguishability, making it difficult for developers to quickly identify different workspaces visually. The dsh-workspace-colors plugin solves this pain point by assigning dedicated colors to sidebar workspaces, overlaying a page background tint, and providing a memory monitoring panel, improving interface readability and the development experience.

Core Features

This is a zero-dependency DSH Web appearance enhancement plugin with the following three capabilities:

  1. Dedicated sidebar workspace colors: Assigns a fixed color to each workspace in the sidebar, including folder icon coloring, a left-side color bar on the title row, and group backgrounds, with support for light and dark themes.
  2. Page background tint: Uses the official ctx.theme.overrideTokens() token override layer to add a hue overlay to the entire interface. Supports light/dark themes and provides 6 preset colors (dusty green, warm beige, sky blue, lavender, cherry pink, navy).
  3. Memory Reclaim Panel: A host-side semi-registered read-only interface for reporting RSS/CPU usage of DSH backend processes and the combined memory usage of Chrome renderer processes. It also supports toggling the auto-reclaim.sh daemon via a configuration file.

Installation and Activation

Add the plugin using the official install command:

dsh plugin --profile web add github:MirrMeur/dsh-workspace-colors

After installation, the dsh web process must be restarted for the changes to take effect (refreshing the browser is not sufficient).

Usage Configuration

Open Settings → Appearance Enhancement to configure the following options:

  • Page Background: Turn on the switch, choose a preset color, and adjust the intensity slider (default 45%). The configuration is saved in the browser’s localStorage.
  • Workspace Colors: Turn on the switch and click the “Reassign” button to have the system assign colors to workspaces in order.
  • Memory Reclaim: View the status panel and turn on the daemon switch.

Color Rules and Manual Configuration

The plugin is built on the OKLCH perceptually uniform color space. Each workspace color is composed of a fixed set of lightness and chroma values; only the hue changes, ensuring that all workspace colors have a consistent quality. The hue library contains 10 presets (red, orange, gold, green, cyan, sky, blue, purple, magenta, rose), automatically assigned in the order workspaces first appear. If background tint is enabled and the hue difference between a workspace color and the background hue is ≤45°, the system automatically reassigns the color to avoid conflicts.

To manually specify a workspace color, modify the configuration in localStorage:

const m = JSON.parse(localStorage.getItem('dsh-workspace-colors.map'));
m['日常工作'] = 215;          // 0-360 任意色相
localStorage.setItem('dsh-workspace-colors.map', JSON.stringify(m));

Technical Details

The plugin’s host side partially relies on webServer injection, while the client side partially uses slots/locale/theme services. It does not depend on dsh-client-runtime.

Regarding the POST restart operation for the memory reclaim interface: this feature is only effective when the DSH backend is managed by launchd (ppid === 1). A manually started backend process will not automatically restart after being killed; in this case, the interface returns a 409 not-launchd-managed error.

Uninstallation

To remove the plugin:

dsh plugin --profile web remove dsh-workspace-colors