Introduction¶
The DSH “Add Workspace” workflow requires selecting a workspace directory. By default, the directory selector starts from the user’s home directory; if a project is fixed in a non-home directory like E:\python_project, manual navigation is required every time a workspace is added. The dsh-workspace-default-dir introduced below is used to change this default initial directory.
What is this¶
dsh-workspace-default-dir is a DSH client plugin maintained by dragan2023 and released under the MIT license. It sets the default initial directory for the DSH “Add Workspace” directory selector, overrides both the native Windows dialog and browse picker backends, and provides a GUI settings card at Settings → Workspace default directory.
Core Features¶
- Sets the default initial directory for the “Add workspace” directory selector.
- Overrides both native Windows dialog and browse picker backends.
- Provides a GUI settings card:
Settings → Workspace default directory. - Provides CLI commands:
dsh-workspace-default-dir set/get/clear/status. - GUI and CLI sync write to
DSH_PICKER_INITIAL_DIR(setx-persisted). - Registry fallback: reads process environment variables first, then reads
HKCU\Environment. - Self-healing: idempotently reapplies the two backend patches on every
dsh boot. - Patch-type plugin: performs idempotent, incremental modifications on the two picker package files within the dsh installation.
Installation and Activation¶
Installation Prerequisites¶
The documentation states that package.json requires Node >=18, with react ^18.2.0 as a peerDependency.
Installation Command¶
Execute the command below first to install the plugin from the GitHub repository:
dsh plugin --profile web add https://github.com/dragan2023/dsh-workspace-default-dir
The npm installation command in the README is marked for use after publishing to npm; since the publishing status is unconfirmed, this article only provides the GitHub installation command.
Activation¶
After installation, restart dsh web. After the steps above, an entry for Workspace default directory will appear under Settings.
Typical Usage¶
GUI Settings¶
- Open
Settings → Workspace default directory. - Input an absolute path, for example
E:\python_project, and clickSave. - The next time the
Add workspacedirectory selector is opened, it will start from that directory. - If you need to restore the default, leave the input box empty and save, or click
Clearto restore to the user’s home directory.
CLI Settings¶
Since GUI and CLI write to the same DSH_PICKER_INITIAL_DIR, they remain in sync. Common commands are as follows:
dsh-workspace-default-dir set E:\python_project
dsh-workspace-default-dir get
dsh-workspace-default-dir clear
dsh-workspace-default-dir status
Scenarios and Notes¶
Suitable for using DSH on Windows with frequently fixed workspace directories. Before using it, pay attention to the following points:
- Verified on Windows +
dsh 0.1.0-rc.6; other platform support status is unconfirmed. If patch edits on other platforms/versions don’t match, a warning will be logged and the patch skipped;dshwill still start. - This is a patch-type plugin: it modifies two picker package files in the dsh installation; the modifications are idempotent and incremental.
- The browse backend patch module is loaded when
dshstarts; an installation/upgrade requires onedsh webrestart; the native dialog reads the worker every time it opens. - The plugin runs with the current
dshprocess permissions; it is recommended to check the source code on the GitHub repository before installation and confirm the MIT license. - The npm installation command in the README is marked as “when published to npm”; the publishing status is unconfirmed; this article does not use the npm installation method.
Reference Links¶
- Plugin directory page: https://www.skillhub.cn/plugins/dragan2023/dsh-workspace-default-dir
- GitHub: https://github.com/dragan2023/dsh-workspace-default-dir