Skip to content

fix(desktop): default window title to app name instead of laufey_webview#35541

Merged
bartlomieju merged 2 commits into
mainfrom
fix/desktop-default-window-title
Jun 29, 2026
Merged

fix(desktop): default window title to app name instead of laufey_webview#35541
bartlomieju merged 2 commits into
mainfrom
fix/desktop-default-window-title

Conversation

@bartlomieju

@bartlomieju bartlomieju commented Jun 26, 2026

Copy link
Copy Markdown
Member

Fixes #35501.

A desktop app window that the app doesn't explicitly title showed the
backend's internal default, laufey_webview, rather than the configured
desktop.app.name from deno.json. This was visible on the docs "Hello
desktop" example, where the window title bar read laufey_webview.

The app name is already baked into the compiled binary at compile time
(from desktop.app.name, falling back to the output file name). This
change uses it as the default window title: the initial window is titled
at creation, and the BrowserWindow constructor applies the same default
to any further untitled windows via a new DesktopAppName value in op
state.

An explicit title option on new BrowserWindow({ title }) still takes
precedence, and a page that sets document.title still overrides the
title at the OS level, so this only changes the previously-empty default.

No automated test is included: desktop window titles are GUI/laufey-bound
and not exercisable in CI. Verified manually against the docs "Hello
desktop" example.

A desktop app window that isn't given an explicit title showed the
backend's internal default ("laufey_webview") instead of the configured
`desktop.app.name`. Default the title to the app name (baked into the
compiled binary at compile time) so an untitled window shows e.g.
"MyApp".

The initial window is titled at creation, and the `BrowserWindow`
constructor applies the same default to any further untitled windows via
`DesktopAppName` in op state. An explicit `title` option, or a page that
sets `document.title`, still overrides it.

@bartlomieju bartlomieju left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct and well-scoped — explicit-title precedence is preserved and DesktopAppName is in op state before any JS runs. Two non-blocking nits below.

Also, no automated test here: desktop window titles are GUI/laufey-bound and hard to exercise in CI, so I don’t think a test is required, but a one-line note in the PR acknowledging that would be good.

Comment thread cli/rt_desktop/lib.rs Outdated
state.put(denort::desktop::InitialWindowId(std::sync::Mutex::new(
Some(window_id),
)));
if let Some(name) = app_name {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the initial-window path above filters empty (.filter(|n| !n.is_empty())), but this state.put stores DesktopAppName even for an empty string. Harmless because the BrowserWindow constructor re-checks !name.0.is_empty(), but filtering here too keeps the two paths symmetric, e.g. if let Some(name) = app_name.filter(|n| !n.is_empty()).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 7a621fb — filtering the empty string here too keeps the two paths symmetric.

Keep the op-state path symmetric with the initial-window path, which
already filters empty names. The BrowserWindow constructor still
re-checks for an empty name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deno desktop window title is laufey_webview instead of desktop.app.name from deno.jsonc

1 participant