Browser userscript
Open ytmd:// from music.youtube.com / youtube.com via Tampermonkey
The YTMDesktop Open Links userscript soft-opens actionable YouTube Music / YouTube / youtu.be pages in the desktop app via ytmd:// when you load or SPA-navigate to them.
It does not intercept link clicks — browsing in the tab stays normal.
Install
- Install Tampermonkey or Violentmonkey.
- Build the script from the monorepo:
pnpm userscript:build- Open
packages/userscript/dist/ytmdesktop-userscript.user.jsin the browser and confirm install.
Matched hosts: music.youtube.com, youtube.com, m.youtube.com, youtu.be.
YTMDesktop2 must be installed (or the ytmd:// protocol registered) so the OS hands the URL to the app.
Behavior
| Event | Action |
|---|---|
| Page load / SPA navigate | If that host setting is on and the URL is actionable, soft-open ytmd://… (tab stays) |
| Link click | Unchanged — browser follows https as usual |
Actionable paths: watch (?v=), playlist (?list=), channel (/channel/UC…), @handle, /shorts/…, /embed/…, and youtu.be /{videoId}. Home, search, and browse are skipped.
Transform is the same address-bar trick as shared links: https:// → ytmd:// on convertible hosts.
Tampermonkey menu
Open the Tampermonkey / Violentmonkey menu on a matched page:
| Command | Default | Effect |
|---|---|---|
| YTMDesktop: music.youtube.com — ON/OFF | ON | Auto-open on load/navigate for Music |
| YTMDesktop: youtube.com — ON/OFF | OFF | Auto-open for youtube.com / www |
| YTMDesktop: m.youtube.com — ON/OFF | OFF | Auto-open for mobile YouTube |
| YTMDesktop: youtu.be — ON/OFF | OFF | Auto-open for short links |
| YTMDesktop: Open this page now | — | Open current URL as ytmd:// (ignores host toggles) |
Settings persist via GM_setValue.
Develop
pnpm userscript:devSee packages/userscript/README.md in the repo.