Skip to content

Commit e7bd3d5

Browse files
authored
docs(desktop): document deep-link URL schemes (#3373)
1 parent 58575a1 commit e7bd3d5

3 files changed

Lines changed: 60 additions & 6 deletions

File tree

api_links_test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const DIRS_TO_CHECK = ["./runtime"];
99
* Matches: `Deno.serve` `Deno.readFile()` `Deno.FsFile`
1010
* Ignores: [`Deno.serve`](/api/deno/~/Deno.serve) (already linked)
1111
* Ignores: references inside fenced code blocks
12+
* Ignores: section headings (linking a heading breaks anchor nav, see #3358)
1213
*/
1314
function findUnlinkedDenoApis(
1415
content: string,
@@ -26,6 +27,10 @@ function findUnlinkedDenoApis(
2627
}
2728
if (inCodeBlock) continue;
2829

30+
// Skip headings: linking a section heading to the API reference breaks the
31+
// on-this-page anchor navigation (see issue #3358).
32+
if (/^#{1,6}\s/.test(line)) continue;
33+
2934
// Match `Deno.something` or `Deno.something()` NOT preceded by [
3035
const regex = /(?<!\[)`(Deno\.[a-zA-Z]\w+(?:\.\w+)*?)(?:\(\))?`/g;
3136
let match;

runtime/desktop/configuration.md

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
last_modified: 2026-06-25
2+
last_modified: 2026-06-30
33
title: "Configuration"
4-
description: "Configure deno desktop in deno.json: app metadata, icons, backend selection, output paths, error reporting, and the auto-update server."
4+
description: "Configure deno desktop in deno.json: app metadata, icons, deep-link URL schemes, backend selection, output paths, error reporting, and the auto-update server."
55
---
66

77
:::info Available in Deno 2.9
@@ -21,6 +21,7 @@ still compiles, using sensible defaults.
2121
{
2222
"name": "my-app",
2323
"version": "1.4.0",
24+
"exports": "./main.ts",
2425
"desktop": {
2526
"app": {
2627
"name": "My App",
@@ -29,7 +30,8 @@ still compiles, using sensible defaults.
2930
"macos": "./icons/app.icns",
3031
"windows": "./icons/app.ico",
3132
"linux": "./icons/app.png"
32-
}
33+
},
34+
"deepLinks": ["myapp"]
3335
},
3436
"backend": "cef",
3537
"output": {
@@ -101,6 +103,52 @@ are assembled into the right container per platform.
101103

102104
If no `icons` entry is set for a platform, the default Deno icon is used.
103105

106+
### `app.deepLinks`
107+
108+
Custom URL schemes (deep links) the app registers with the OS, so that opening a
109+
`<scheme>://...` link routes to your app. Each entry is a bare scheme name with
110+
no `://`.
111+
112+
```jsonc
113+
"deepLinks": ["myapp"]
114+
```
115+
116+
With the above, the OS treats `myapp://open/document/42` as belonging to your
117+
app. List several schemes if your app handles more than one:
118+
119+
```jsonc
120+
"deepLinks": ["myapp", "myapp-beta"]
121+
```
122+
123+
Scheme names follow the
124+
[RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986#section-3.1) grammar:
125+
they must start with an ASCII letter and may otherwise contain letters, digits,
126+
`+`, `-`, and `.`. Names are lowercased during registration. The reserved
127+
schemes `http`, `https`, `file`, `ftp`, `ws`, and `wss` are rejected, since
128+
registering them as app handlers would hijack normal browsing. An invalid or
129+
reserved scheme fails the build.
130+
131+
Registration happens at bundle time, per platform:
132+
133+
- **macOS** adds a `CFBundleURLTypes` entry (with your schemes under
134+
`CFBundleURLSchemes`) to the bundle `Info.plist`. This is written before
135+
code-signing so the signature stays valid.
136+
- **Linux** adds an `x-scheme-handler/<scheme>` MIME type to the `.desktop`
137+
entry and ensures `Exec=` forwards the opened URL via the `%u` field code.
138+
- **Windows** has no in-bundle registration for protocol handlers, so the
139+
bundler drops a `register-deep-links.bat` next to the launcher. It writes the
140+
`HKCU\Software\Classes\<scheme>` keys pointing back at the launcher. An
141+
installer (or the user) runs it once after install.
142+
143+
:::info Registration only
144+
145+
This registers the schemes with the OS so links are routed to your app. Handling
146+
the opened URL inside a running app (delivering the URL to your code) is coming
147+
in a later release; declare your schemes now so packaging and OS registration
148+
are in place.
149+
150+
:::
151+
104152
## `backend`
105153

106154
Which web rendering engine to embed. One of `"cef"`, `"webview"`, or `"raw"`.
@@ -221,5 +269,6 @@ Configuration is validated at the start of `deno desktop`:
221269
- Icon paths must resolve to existing files.
222270
- Output paths must be writable.
223271
- `release.baseUrl` must parse as a URL.
272+
- `app.deepLinks` entries must be valid, non-reserved URL schemes.
224273

225274
Errors are reported with the offending `deno.json` location.

runtime/desktop/tray_and_dock.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
last_modified: 2026-06-25
2+
last_modified: 2026-06-30
33
title: "Tray and dock"
44
description: "Add icons to the OS status area and the macOS dock: tooltips, dark-mode variants, click events, and right-click context menus."
55
---
@@ -18,7 +18,7 @@ version, [update Deno](/runtime/reference/cli/upgrade/) to use it.
1818

1919
Menus on both use the [`Deno.MenuItem`](/runtime/desktop/menus/) type.
2020

21-
## [`Deno.Tray`](/api/deno/~/Deno.Tray)
21+
## `Deno.Tray`
2222

2323
```ts
2424
const icon = await Deno.readFile("./icons/tray.png");
@@ -210,7 +210,7 @@ If the backend cannot create a tray icon, the constructor's underlying `trayId`
210210
is `0` and subsequent calls are no-ops (silently). Check `tray.trayId !== 0` if
211211
you need to fall back gracefully.
212212

213-
## [`Deno.dock`](/api/deno/~/Deno.dock)
213+
## `Deno.dock`
214214

215215
[`Deno.dock`](/api/deno/~/Deno.dock) is a singleton exposing the app's dock /
216216
taskbar controls. The methods are cross-platform but their effect varies:

0 commit comments

Comments
 (0)