- Home
- Plugins
- Tools & Capabilities
- dsh-media-keys
dsh-media-keys
xionglongztz/dsh-media-keys
🎵 Windows Media-key control for DSH: play/pause, stop, previous, next, mute, volume up/down through Windows media keys. | 为DSH设计的Windows媒体操作工具
Install
dsh plugin --profile web add github:xionglongztz/dsh-media-keysREADME
dsh-media-keys
A DSH Host bundle that exposes one tool, media_control, so the assistant can press a
Windows media key on request: play/pause, stop, previous track, next track, mute,
volume up, volume down.
- UI: none. The bundle only registers a tool.
- Platform: Windows (
dsh.bundle.platforms: ["win32"]), because it drives the Windows media keys throughSendInput. - Requirements: none beyond DSH itself — no npm dependencies, no peer dependencies.
Install
Three ways, whichever fits:
-
DSH application (desktop profile): open the plugin page and install from the repository (
<owner>/<repo>), a git URL, or an absolute directory path. The desktop profile is owned by the Electron application, so the CLI rejects--profile desktop. -
CLI-managed profile:
dsh plugin --profile <profile> add /absolute/path/to/media-keys dsh plugin --profile <profile> add github:<owner>/<repo> dsh plugin --profile <profile> add dsh-media-keys # once published to npm -
Local development: keep the package directory somewhere stable (for example
~/.dsh/plugins/media-keys) and install from that path; the profile keeps alink:dependency, so editing the source takes effect after the host reloads the plugin.
Restart the application (or let the loader reload the profile) after installing.
What the tool does
media_control takes exactly one argument:
| action | Windows key |
|---|---|
play_pause | VK_MEDIA_PLAY_PAUSE |
stop | VK_MEDIA_STOP |
previous | VK_MEDIA_PREV_TRACK |
next | VK_MEDIA_NEXT_TRACK |
mute | VK_VOLUME_MUTE |
volume_up | VK_VOLUME_UP |
volume_down | VK_VOLUME_DOWN |
Every call sends exactly one key press (key down, 30 ms, key up). One volume key press is one Windows volume step of 2 points on the 0–100 scale; Windows clamps the result at 100 and 0. A larger change means calling the tool several times, which keeps every single step bounded and auditable.
Known limitations
- This bundle sends keys; it cannot know how the receiving application maps them. Applications that own their own media-key handling may behave differently from the Windows default. In particular foobar2000 maps "previous track" to "restart the current track" and only goes to the previous track when pressed again at the start of a track. That is foobar2000's own shortcut semantics, not a key the bundle can change.
- Volume keys move the system volume by one Windows step (2 points on the 0–100 scale); Windows clamps at 100 and 0. Anything larger takes several calls by design.
- Windows only: the bundle drives
SendInputthrough Windows PowerShell.
Security posture
- The action is validated against a frozen table before anything runs; unknown actions and unknown argument keys are rejected.
- The PowerShell program is a fixed template. Its only substituted value is the virtual-key code from that table — never model text, an argument, a path, or an environment value.
- The program is passed as base64 through
-EncodedCommand, so there is no quoting or shell-injection surface. - PowerShell runs with
-NoProfile -NonInteractive -ExecutionPolicy Bypass,windowsHide: true, a 20 s timeout, and is killed when the tool call is cancelled. SendInputis checked: if the desktop refuses the injection (for example a UIPI block), the Win32 error is raised instead of reporting a key that never arrived.
Related plugins
archify (deepseek-harness)
tt-a1i/archify
WeKnora (dsh-weknora)
tencent/weknora
next-ai-draw-io (dsh-plugin)
dayuanjiang/next-ai-draw-io
AiToEarn (dsh-plugin-aitoearn)
yikart/aitoearn