Skip to content

feat(desktop): window opacity and transparency APIs - #35646

Merged
crowlKats merged 3 commits into
denoland:mainfrom
crowlKats:feat/window-opacity-transparency
Jul 2, 2026
Merged

crowlKats merged 3 commits into
denoland:mainfrom
crowlKats:feat/window-opacity-transparency

Conversation

@crowlKats

@crowlKats crowlKats commented Jun 30, 2026 •

Copy link
Copy Markdown
Member

Exposes window opacity/transparency to the Deno desktop API. Closes #35583.

Backed by the laufey changes in littledivy/laufey#32 (laufey API version 28).

API

Two distinct things:

  • Opacity — BrowserWindow.getOpacity() / setOpacity(n) and the opacity constructor option fade the whole window (chrome + content) by a uniform factor in 0..=1, like CSS opacity. Out-of-range values are clamped.
  • Transparency — the transparent constructor option gives the window a transparent background so the page's own per-pixel alpha composites against whatever is behind it. Commonly paired with frameless. Supported on macOS and Linux with the system WebView; ignored on Windows and with CEF (opaque window background).
const win = new Deno.BrowserWindow({ frameless: true, transparent: true, opacity: 0.9 });
win.setOpacity(0.5);
const o = win.getOpacity();

Changes

  • runtime/ops/desktop.rs — DesktopApi trait gains a transparent create-window param and get_window_opacity/set_window_opacity; opacity/transparent added to BrowserWindowOptions and wired through the BrowserWindow constructor; getOpacity/setOpacity ops.
  • cli/rt_desktop/lib.rs — implements the new methods against laufey::Window and passes transparent into WindowOptions.
  • cli/tsc/dts/lib.deno.desktop.d.ts — typings + docs.

Expose the laufey window opacity/transparency support added in
denoland/laufey#32 (laufey API version 28):

- BrowserWindow.getOpacity()/setOpacity() and the `opacity` constructor
  option fade the whole window by a uniform factor in [0, 1].
- The `transparent` constructor option gives the window a transparent
  background so the page's per-pixel alpha composites against what is
  behind it (macOS + Linux system WebView; ignored on Windows / CEF).

Closes denoland#35583.
…ransparency

# Conflicts:
#	cli/rt_desktop/lib.rs
@crowlKats
crowlKats merged commit 3551015 into denoland:main Jul 2, 2026
137 checks passed
@crowlKats
crowlKats deleted the feat/window-opacity-transparency branch July 2, 2026 11:43
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: APIs for window opacity/transparency

2 participants