Skip to content

fix(window): make Window Blur show the desktop through the terminal on Linux - #36197

Closed
AdolfoCarneiro wants to merge 1 commit into
stablyai:mainfrom
AdolfoCarneiro:linux-window-transparency
Closed

AdolfoCarneiro wants to merge 1 commit into
stablyai:mainfrom
AdolfoCarneiro:linux-window-transparency

Conversation

@AdolfoCarneiro

Copy link
Copy Markdown

ELI5

On Linux, Orca's window was a solid wall, so the terminal opacity setting had nothing to show through. With Window Blur on, Linux now gets a see-through window, and the terminal background is painted once instead of three times on top of itself.

What Changed

Before: on Linux, Background Opacity 0.82 + Window Blur gave a nearly black terminal. After: the wallpaper shows through the terminal at the configured opacity. The sidebars and other chrome stay opaque.

Mechanism:

  1. createMainWindow.ts: on Linux with Window Blur, create the window with transparent: true and backgroundColor: '#00000000'. macOS and Windows window options are unchanged, so the [Bug]: Window Blur causes sustained high GPU power and heat on macOS #8482 fast path stays intact.
  2. use-document-appearance.ts + main.css: with that mode on (Linux desktop window only, not the paired web client), add window-transparent to <html> and clear the fill on html, body, #root and .app-layout.
  3. terminal.css: inside panes, stop xterm from repainting the translucent theme background on .xterm and .xterm-scrollable-element. The split root already paints it, so the three layers compounded (1 − 0.18³ ≈ 0.994). This part is platform-independent: on macOS/Windows, opacity < 1 now blends at the configured alpha over the app surface instead of about 0.99. With dark themes the difference is small.

Why

Linux compositors (KWin, Mutter, Hyprland, Sway, picom) composite transparent windows natively and blur them through their own rules: KWin with a blur effect, Hyprland out of the box, GNOME through extensions. A real transparent window is the only thing that lets those tools work, and it is what Konsole, kitty, Alacritty and Ghostty do on Linux.

Alternatives considered:

Linked Issue

Fixes #36196

Related: #8797 (macOS side), #8482, #12470

Visual Proof

Fedora 44, KDE Plasma 6.7 (Wayland), Background Opacity 0.82, Window Blur on. Cropped to the terminal area.

Before After
before after

Testing

  • Ran a dev build (pnpm dev) on Fedora 44 / KDE Plasma 6.7.5 / Wayland with a seeded profile. Checked the computed backgrounds over CDP: only the split root paints rgba(0,0,0,0.82); .xterm, .pane, html, body, #root and .app-layout are transparent. Then confirmed on screen that the wallpaper shows through.

  • Turning Window Blur off and restarting gives the old opaque window.

  • Rough idle CPU comparison, 3 × 20 s each with a terminal open: Orca 2–6% opaque vs 2–8% transparent. KWin varied between 30% and 55% in both modes because of other windows on screen, so I can't measure a difference within that noise. On Linux the cost lives in the compositor, which already handles translucent terminals like Konsole.

  • Not tested on macOS or Windows. Their BrowserWindow options are unchanged and covered by the existing test.

  • With no compositor (bare X11), the transparent area is expected to render black, which looks like the opaque window. The setting is opt-in.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below: updated the createMainWindow platform test (Linux now expects transparent: true and a clear background). The CSS layering is checked visually; a unit test for computed styles would be low value.

AI Disclosure

Written with Claude Code (Claude Opus 5.5). I reviewed the diff and tested it on my machine.

Review

Open question for maintainers: on Linux, the setting is still labelled "Window Blur" even though Orca only makes the window transparent and the compositor decides about blur. I left the label and localization alone to keep this PR small. Happy to add a Linux-specific description if you'd like.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • Remote/SSH and mobile: not affected; this only changes local window creation and CSS.
  • Backwards compatibility: no new setting; the existing windowBackgroundBlur now does something on Linux.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred): pnpm check:changed passes locally (29 checks); CI will cover the full build.

🤖 Generated with Claude Code

…n Linux

On Linux the main window was always created opaque, so Background Opacity
only blended the terminal toward #0a0a0a and Window Blur did nothing (stablyai#8797).

- Linux + Window Blur: create the window with `transparent: true` and a clear
  background color; KWin, Hyprland, picom and others already blur translucent
  windows through their own rules.
- Drop the root fill (html/body/#root/.app-layout) while that mode is on, scoped
  to Linux desktop windows.
- Stop xterm from repainting the translucent theme background on its element
  and viewport inside panes. The split root already paints it, so the three
  layers compounded (0.82 opacity rendered as ~0.99).

macOS and Windows window options are unchanged (stablyai#8482).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

Linux windows now use a transparent background when window blur is enabled. The renderer toggles a document class for Linux windows that are not paired web clients. CSS makes the native shell and eligible terminal backgrounds transparent. Tests cover platform-specific transparency and background colors.

Priority: Normal

Severity of issue fixed: Medium

Merge Risk: Low · up to 6c4c1

With Window Blur on Linux, the terminal becomes translucent as intended. When GPU acceleration is active, the terminal grid may look more opaque than the configured opacity, because the WebGL layer paints the background again. This is a cosmetic shortfall against the PR's goal and can be fixed in a follow-up by extending the existing xterm WebGL patch.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title is concise, specific, and accurately describes the main Linux Window Blur transparency change.
Description check Passed The description covers the required sections, user-visible behavior, implementation, rationale, linked issue, visual proof, testing, platform scope, and checklist status. It clearly notes that macOS a…
Linked Issues check Passed Issue #36196 requires Linux transparency when Window Blur is enabled so the desktop can show through after restart. createMainWindow.ts sets transparent: true and #00000000 on Linux in that mode…
Out of Scope Changes check Passed The changes stay within issue #36196. The Linux BrowserWindow options and document transparency implement the requested desktop visibility. The xterm CSS change supports the opacity behavior described…
Full details: Description check

Explanation

The description covers the required sections, user-visible behavior, implementation, rationale, linked issue, visual proof, testing, platform scope, and checklist status. It clearly notes that macOS and Windows were not manually tested and that the full build is deferred to CI.

Full details: Linked Issues check

Explanation

Issue #36196 requires Linux transparency when Window Blur is enabled so the desktop can show through after restart. createMainWindow.ts sets transparent: true and #00000000 on Linux in that mode. use-document-appearance.ts applies window-transparent only to the native Linux window. The supplied change summary reports transparent fills for html, body, #root, and .app-layout, and the terminal CSS removes repeated xterm background painting. The updated platform test covers the Linux window options. These changes satisfy the linked coding requirements.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #36196. The Linux BrowserWindow options and document transparency implement the requested desktop visibility. The xterm CSS change supports the opacity behavior described by the issue and prevents repeated background compositing. The platform test is supporting automated coverage. No unrelated product area or platform behavior is changed; macOS and Windows window options remain unchanged.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 3 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a1ca6894-9a1e-4944-837e-65b2011fa8e6
Commits

Reviewing files that changed from the base of the PR and between 6be126d and 6c4c178.

Files selected for processing: 5
  • src/main/window/createMainWindow.test.ts
  • src/main/window/createMainWindow.ts
  • src/renderer/src/app-shell/use-document-appearance.ts
  • src/renderer/src/assets/main.css
  • src/renderer/src/assets/terminal.css

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment on lines +40 to +45
/* The split root already paints the translucent theme background; xterm repeating it compounds alpha (0.82³ ≈ 0.99). */
.pane .xterm.allow-transparency,
.pane .xterm.allow-transparency .xterm-scrollable-element {
background-color: transparent !important;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor · Functional Correctness · Quick win

Supported by static analysis

Script executed:

rg -n 'allowTransparency|allow-transparency' src/renderer | head -40
rg -n 'clearColor|RectangleRenderer|isDefaultBg|DEFAULT_BG|background' config/patches/xterm-src/@[email protected] | head -40

Repository: stablyai/orca

Length of output: 1747


Web query:

xterm.js addon-webgl RectangleRenderer default background cells skipped clearColor transparent allowTransparency

Result:

<source_evidence>
<source kind="search">
<title>WebGL: opaque background rectangle painted behind italic/dim cells when the theme background is transparent (alpha hard-coded in RectangleRenderer) · Issue #6116 · xtermjs/xterm.js · GitHub</title>
<location>GitHub issue 6116 in xtermjs/xterm.js (link omitted to avoid creating a cross-reference)</location>
<excerpt>citeturn0search0 [wordlim: 200] Published: 2 months ago; Crawled: 2 months ago; # WebGL: opaque background rectangle painted behind italic/dim cells when the theme background is transparent (alpha hard-coded in RectangleRenderer) #6116 ... With `allowTransparency: true` and a theme background of `rgba(0, 0, 0, 0)`, the WebGL renderer paints an opaque black rectangle behind any cell that is italic or dim, even though those cells have no background colour. ...     term.write(&#39;plain \x1b[3mitalic\x1b[0m \x1b[2mdim\x1b[0m plain&#39;); ... This is easy to hit in practice: PSReadLine&#39;s default `InlinePredictionColor` is `ESC[97;2;3m` — bright white, dim, italic — so every inline prediction in a PowerShell session renders inside a black box in any embedder that uses a transparent background.

# WebGL: opaque background rectangle painted behind italic/dim cells when the theme background is transparent (alpha hard-coded in RectangleRenderer) #6116

New issue

Copy link

New issue

Copy link

Open

Open

WebGL: opaque background rectangle painted behind italic/dim cells when the theme background is transparent (alpha hard-coded in RectangleRenderer)#6116

Copy link

## Description

azekyoo

opened on Aug 19, 2026

Issue body actions

## Summary

With `allowTransparency: true` and a theme background of `rgba(0, 0, 0, 0)`, the WebGL renderer paints an opaque black rectangle behind any cell that is italic or dim, even though those cells have no background colour. The DOM renderer draws them correctly.

The reason is that `RectangleRenderer._updateRectangle()` discards the colour&#39;s alpha channel:
    
    $a = 1;

## Why italic and dim cells are affected

`updateBackgrounds()` decides a cell needs a background rectangle with:
    
    if (currentBg !== 0 || (currentInverse &amp;&amp; currentFg !== 0))

`currentBg` is the raw `bg` field, which carries attribute flags as well as colour — `BgFlags.ITALIC` and `BgFlags.DIM` both live there. So a cell with default colours but the italic or dim attribute set has `bg !== 0` and is treated as having a background.

That would be harmless if the resulting rectangle respected the theme&#39;s alpha. Because `$a` is forced to `1`, the default-background branch:
    
    $rgba = this._themeService.colors.background.rgba;   // rgba(0,0,0,0)

yields RGB `0,0,0` with the alpha thrown away — an opaque black box.

## Reproduction
    
    const term = new Terminal({
      allowTransparency: true,
      theme: { background: &#39;rgba(0, 0, 0, 0)&#39; }
    });
    term.loadAddon(new WebglAddon());
    term.open(document.querySelector(&#39;#t&#39;));   // give #t a visible background image
    term.write(&#39;plain \x1b[3mitalic\x1b[0m \x1b[2mdim\x1b[0m plain&#39;);

Expected: all four words sit on the page background.
Actual: `italic` and `dim` each sit in an opaque black rectangle. Removing `WebglAddon` (DOM renderer) renders as expected.

This is easy to hit in practice: PSReadLine&#39;s default `InlinePredictionColor` is `ESC[97;2;3m` — bright white, dim, italic — so every inline prediction in a PowerShell session renders inside a black box in any embedder that uses a transparent background.

## Versions

`@xterm/xterm` 6.0.0, `@xterm/addon-webgl` 0.19.0, Electron 43.1.1, Windows 11.

## Suggested fix

Take the alpha from the colour rather than hard-coding it. Note that the two true-colour branches build their value as `(fg &amp; Attributes.RGB_MASK) &lt;&lt; 8` / `(bg &amp; Attributes.RGB_MASK) &lt;&lt; 8`, which leaves the alpha byte at `0` — so those need a solid alpha first, otherwise every 24-bit background would become transparent instead:
    
    case Attributes.CM_RGB:
      $rgba = ((bg &amp; Attributes.RGB_MASK) &lt;&lt; 8) | 0xFF;
      break;
    ...
    $a = ($rgba &amp; 0xFF) / 255;

I&#39;m carrying exactly that as a local patch and it fixes the artifact with no effect on opaque themes or true-colour backgrounds.

A possible alternative, if the intent was that attribute-only `bg` values shouldn&#39;t produce a rectangle at all, is to mask the colour bits in the `updateBackgrounds()` condition — but the alpha handling looks like a bug independently of that.

Reactions are currently unavailable</excerpt>
</source>
<source kind="search">
<title>ITerminalOptions</title>
<location>https://xtermjs.org/docs/api/terminal/interfaces/iterminaloptions/</location>
<excerpt>citeturn0search3 [wordlim: 200] Crawled: 2 weeks ago; Defined in xterm.d.ts:32 ... ### `Optional` allowTransparency ... Whether background should support non-opaque color.
# Interface: ITerminalOptions

An object containing options for the terminal.

### `Optional` allowProposedApi

• allowProposedApi? : boolean

Defined in xterm.d.ts:32

Whether to allow the use of proposed API. When false, any usage of APIs marked as experimental/proposed will throw an error. The default is false.

* * *

### `Optional` allowTransparency

• allowTransparency? : boolean

Defined in xterm.d.ts:40

Whether background should support non-opaque color. It must be set before executing the `Terminal.open()` method and can’t be changed later without executing it again. Note that enabling this can negatively impact performance.

* * *

### `Optional` altClickMovesCursor

• altClickMovesCursor? : boolean

Defined in xterm.d.ts:46

If enabled, alt + click will move the prompt cursor to position underneath the mouse. The default is true.

* * *

### `Optional` convertEol

• convertEol? : boolean

Defined in xterm.d.ts:58
</excerpt>
</source>
<source kind="search">
<title>WebGL: opaque background rectangle painted behind italic/dim cells when the theme background is transparent (alpha hard-coded in RectangleRenderer) · Issue #6116 · xtermjs/xterm.js · GitHub</title>
<location>GitHub issue 6116 in xtermjs/xterm.js (link omitted to avoid creating a cross-reference)</location>
<excerpt>citeturn1search0 [wordlim: 200] Published: 2 months ago; Crawled: 2 months ago; The reason is that `RectangleRenderer._updateRectangle()` discards the colour&#39;s alpha channel: ...     term.write(&#39;plain \x1b[3mitalic\x1b[0m \x1b[2mdim\x1b[0m plain&#39;);

# WebGL: opaque background rectangle painted behind italic/dim cells when the theme background is transparent (alpha hard-coded in RectangleRenderer) #6116

New issue

Copy link

New issue

Copy link

Open

Open

WebGL: opaque background rectangle painted behind italic/dim cells when the theme background is transparent (alpha hard-coded in RectangleRenderer)#6116

Copy link

## Description

azekyoo

opened on Aug 19, 2026

Issue body actions

## Summary

With `allowTransparency: true` and a theme background of `rgba(0, 0, 0, 0)`, the WebGL renderer paints an opaque black rectangle behind any cell that is italic or dim, even though those cells have no background colour. The DOM renderer draws them correctly.

The reason is that `RectangleRenderer._updateRectangle()` discards the colour&#39;s alpha channel:
    
    $a = 1;

## Why italic and dim cells are affected

`updateBackgrounds()` decides a cell needs a background rectangle with:
    
    if (currentBg !== 0 || (currentInverse &amp;&amp; currentFg !== 0))

`currentBg` is the raw `bg` field, which carries attribute flags as well as colour — `BgFlags.ITALIC` and `BgFlags.DIM` both live there. So a cell with default colours but the italic or dim attribute set has `bg !== 0` and is treated as having a background.

That would be harmless if the resulting rectangle respected the theme&#39;s alpha. Because `$a` is forced to `1`, the default-background branch:
    
    $rgba = this._themeService.colors.background.rgba;   // rgba(0,0,0,0)

yields RGB `0,0,0` with the alpha thrown away — an opaque black box.

## Reproduction
    
    const term = new Terminal({
      allowTransparency: true,
      theme: { background: &#39;rgba(0, 0, 0, 0)&#39; }
    });
    term.loadAddon(new WebglAddon());
    term.open(document.querySelector(&#39;#t&#39;));   // give #t a visible background image
    term.write(&#39;plain \x1b[3mitalic\x1b[0m \x1b[2mdim\x1b[0m plain&#39;);

Expected: all four words sit on the page background.
Actual: `italic` and `dim` each sit in an opaque black rectangle. Removing `WebglAddon` (DOM renderer) renders as expected.

This is easy to hit in practice: PSReadLine&#39;s default `InlinePredictionColor` is `ESC[97;2;3m` — bright white, dim, italic — so every inline prediction in a PowerShell session renders inside a black box in any embedder that uses a transparent background.

## Versions

`@xterm/xterm` 6.0.0, `@xterm/addon-webgl` 0.19.0, Electron 43.1.1, Windows 11.

## Suggested fix

Take the alpha from the colour rather than hard-coding it. Note that the two true-colour branches build their value as `(fg &amp; Attributes.RGB_MASK) &lt;&lt; 8` / `(bg &amp; Attributes.RGB_MASK) &lt;&lt; 8`, which leaves the alpha byte at `0` — so those need a solid alpha first, otherwise every 24-bit background would become transparent instead:
    
    case Attributes.CM_RGB:
      $rgba = ((bg &amp; Attributes.RGB_MASK) &lt;&lt; 8) | 0xFF;
      break;
    ...
    $a = ($rgba &amp; 0xFF) / 255;

I&#39;m carrying exactly that as a local patch and it fixes the artifact with no effect on opaque themes or true-colour backgrounds.

A possible alternative, if the intent was that attribute-only `bg` values shouldn&#39;t produce a rectangle at all, is to mask the colour bits in the `updateBackgrounds()` condition — but the alpha handling looks like a bug independently of that.

Reactions are currently unavailable</excerpt>
</source>
<source kind="search">
<title>Addon WebGL vs Canvas: Are there additional configurations to make selectionBackground transparent in webgl? · xtermjs xterm.js · Discussion #4432 · GitHub</title>
<location>GitHub discussion 4432 in xtermjs/xterm.js (link omitted to avoid creating a cross-reference)</location>
<excerpt>citeturn0search1 [wordlim: 200] Published: 3.6 years ago; Crawled: 2 months ago; For the webgl renderer we use an opaque version of the background that&#39;s blended with the default background: xterm.js/src/browser/services/ThemeService.ts Lines 104 to 107 in 5b05d45 ... On our terminal, at runtime, selectionBackgroundOpaque seems the same value as the selectionBackground and then selectionBackgroundTransparent is having the added 4d in the end for transparency hexa - which i believe is due to the `if (color.isOpaque(colors.selectionBackgroundTransparent)) { const opacity = 0.3; colors.selectionBackgroundTransparent = color.opacity(colors.selectionBackgroundTransparent, opacity); }` Do you mean to say this the expected behavior?

xtermjs / xterm.js Public

  * Notifications You must be signed in to change notification settings
  * Fork 2k
  * Star

  * Code
  * Issues 174
  * Pull requests 49
  * Discussions
  * Actions
  * Wiki
  * Security and quality 0
  * Insights

# Addon WebGL vs Canvas: Are there additional configurations to make selectionBackground transparent in webgl? #4432

Answered by Tyriar

isubasin asked this question in Q&amp;A

Addon WebGL vs Canvas: Are there additional configurations to make selectionBackground transparent in webgl? #4432

Mar 8, 2023 · 1 comments · 2 replies

Discussion options

## 

isubasin Mar 8, 2023

Hello, We are currently upgrading an application from xterm version 4.14.1 to 5.1.0 and we are unable to get the selectionBackground to display transparently similar to the canvas mode. Application overview:
Note: we can see there are similar issues reported in the past but marked as fixed with #2952
, so just wanted to check what we are missing and if we need to explicitly select it to be transparent . Thank you in advance, looking forward for some good news..!

Answered by Tyriar Aug 1, 2023

@isubasin thats by design, the internal opaque and transparent values try use a best guess value depending on what the theme is. The values then may or may not be used depending on the renderer type.

View full answer

Tyriar Mar 8, 2023

For the webgl renderer we use an opaque version of the background that&#39;s blended with the default background: xterm.js/src/browser/services/ThemeService.ts Lines 104 to 107 in 5b05d45
selectionBackgroundTransparent: DEFAULT_SELECTION,
selectionBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),
selectionInactiveBackgroundTransparent: DEFAULT_SELECTION,
selectionInactiveBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),
</excerpt>
</source>
<source kind="search">
<title>Releases · xtermjs/xterm.js · GitHub</title>
<location>https://github.com/xtermjs/xterm.js/releases</location>
<excerpt>citeturn0search2 [wordlim: 200] Crawled: 2 days ago;   * #5335 webgl: Ignore alpha channel when allowTransparency is false ...   * #5130 Remove xterm- prefix from addon mjs output ...   * Refactor color handling code and add tests (#4927) via @Tyriar ...   * Bring back `clearActiveDecoration` API implementation (#4827) via @Tyriar ...   *   *   *   *   *   *   *   *   *   *   *   *   * dstein64, coderaiser, and 11 other contributors ... This commit was created on GitHub.com and signed with GitHub’s verified signature.
## Fixes

  * #5445 Prefer performance.now() over Date.now()
  * #5437 Prevent entire page from scrolling when scrolling in alt buffer with mouse event off
  * #5423 Clear selection on vertical resize
  * #5411 Fix teleport when exiting out of alt buffer. v2
  * #5391 Bring back partial wheel tracking
  * #5390 Fix scrollbar teleport after exiting alt buffer
  * #5386 fix: ensure that currentRow can not go out of the range
  * #5385 Fix terminal find when wrapped
  * #5355 Add note about reverse tabnapping
  * #5346 Remove alt -&gt; ctrl+arrow hack in favor of embedder-specific solutions
    * ⚠️ This is a breaking change, you will need to add keybindings in your code if you want alt to map to ctrl still
  * #5337 Fix finding terms across wrapped lines
  * #5335 webgl: Ignore alpha channel when allowTransparency is false
  * #5328 Refresh viewport after clear or ED
  * #5305 Fix issue where listeners remain after WebglRenderer throws
</excerpt>
</source>
<omitted_sources count="22">Additional source records were omitted from this bounded result.</omitted_sources>
</source_evidence>

Citations:

- 1: GitHub issue 6116 in xtermjs/xterm.js (link omitted to avoid creating a cross-reference)
- 2: GitHub issue 6116 in xtermjs/xterm.js (link omitted to avoid creating a cross-reference)
- 3: https://xtermjs.org/docs/api/terminal/interfaces/iterminaloptions/?utm_source=openai
- 4: GitHub issue 6116 in xtermjs/xterm.js (link omitted to avoid creating a cross-reference)

Script executed:

set -o pipefail
printf '%s\n' '--- PR diff: relevant files ---'
git diff --no-ext-diff --unified=80 ec62243dedec0ba82b8ef393438eecd8f35fa0ef 6c4c1781d6d09b323751711f033ceae16cf26a5c -- \
  src/renderer/src/assets/terminal.css \
  src/renderer/src/components/terminal-pane/terminal-appearance.ts \
  src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.ts \
  src/renderer/src/lib/pane-manager/pane-terminal-options.ts \
  src/main/window \
  package.json pnpm-lock.yaml config/patches
printf '%s\n' '--- relevant patch files ---'
find config/patches -maxdepth 2 -type f -iname '*webgl*' -o -iname '*xterm*' | sort
printf '%s\n' '--- webgl/rectangle/clear references in patch ---'
rg -n -i -C 8 -- 'clear(Color|ColorBuffer)|clearColor|RectangleRenderer|updateBackgrounds|default.?background|rgba|alpha|allowTransparency|transparent' config/patches | head -300 || true
printf '%s\n' '--- xterm dependency declarations ---'
rg -n -C 4 -- '@xterm/(addon-webgl|xterm)|addon-webgl|0\.20\.0-beta\.300' package.json pnpm-lock.yaml config package.json 2>/dev/null | head -240 || true
printf '%s\n' '--- appearance and webgl consumers ---'
rg -n -C 8 -- 'allowTransparency|WebglAddon|webgl|Window Blur|windowBlur|window-blur|transparent' src/renderer/src src/main | head -500 || true

Repository: stablyai/orca

Length of output: 45647


Web query:

@xterm/addon-webgl 0.20.0-beta.300 source WebglRenderer RectangleRenderer clearColor updateBackgrounds allowTransparency

Result:

<source_evidence>
<source kind="search">
<title>WebGL: opaque background rectangle painted behind italic/dim cells when the theme background is transparent (alpha hard-coded in RectangleRenderer) · Issue #6116 · xtermjs/xterm.js · GitHub</title>
<location>GitHub issue 6116 in xtermjs/xterm.js (link omitted to avoid creating a cross-reference)</location>
<excerpt>citeturn0search0 [wordlim: 200] Published: 2 months ago; Crawled: 2 months ago; # WebGL: opaque background rectangle painted behind italic/dim cells when the theme background is transparent (alpha hard-coded in RectangleRenderer) #6116 ... With `allowTransparency: true` and a theme background of `rgba(0, 0, 0, 0)`, the WebGL renderer paints an opaque black rectangle behind any cell that is italic or dim, even though those cells have no background colour. ... `@xterm/xterm` 6.0.0, `@xterm/addon-webgl` 0.19.0, Electron 43.1.1, Windows 11.

# WebGL: opaque background rectangle painted behind italic/dim cells when the theme background is transparent (alpha hard-coded in RectangleRenderer) #6116

New issue

Copy link

New issue

Copy link

Open

Open

WebGL: opaque background rectangle painted behind italic/dim cells when the theme background is transparent (alpha hard-coded in RectangleRenderer)#6116

Copy link

## Description

azekyoo

opened on Aug 19, 2026

Issue body actions

## Summary

With `allowTransparency: true` and a theme background of `rgba(0, 0, 0, 0)`, the WebGL renderer paints an opaque black rectangle behind any cell that is italic or dim, even though those cells have no background colour. The DOM renderer draws them correctly.

The reason is that `RectangleRenderer._updateRectangle()` discards the colour&#39;s alpha channel:
    
    $a = 1;

## Why italic and dim cells are affected

`updateBackgrounds()` decides a cell needs a background rectangle with:
    
    if (currentBg !== 0 || (currentInverse &amp;&amp; currentFg !== 0))

`currentBg` is the raw `bg` field, which carries attribute flags as well as colour — `BgFlags.ITALIC` and `BgFlags.DIM` both live there. So a cell with default colours but the italic or dim attribute set has `bg !== 0` and is treated as having a background.

That would be harmless if the resulting rectangle respected the theme&#39;s alpha. Because `$a` is forced to `1`, the default-background branch:
    
    $rgba = this._themeService.colors.background.rgba;   // rgba(0,0,0,0)

yields RGB `0,0,0` with the alpha thrown away — an opaque black box.

## Reproduction
    
    const term = new Terminal({
      allowTransparency: true,
      theme: { background: &#39;rgba(0, 0, 0, 0)&#39; }
    });
    term.loadAddon(new WebglAddon());
    term.open(document.querySelector(&#39;#t&#39;));   // give #t a visible background image
    term.write(&#39;plain \x1b[3mitalic\x1b[0m \x1b[2mdim\x1b[0m plain&#39;);

Expected: all four words sit on the page background.
Actual: `italic` and `dim` each sit in an opaque black rectangle. Removing `WebglAddon` (DOM renderer) renders as expected.

This is easy to hit in practice: PSReadLine&#39;s default `InlinePredictionColor` is `ESC[97;2;3m` — bright white, dim, italic — so every inline prediction in a PowerShell session renders inside a black box in any embedder that uses a transparent background.

## Versions

`@xterm/xterm` 6.0.0, `@xterm/addon-webgl` 0.19.0, Electron 43.1.1, Windows 11.

## Suggested fix

Take the alpha from the colour rather than hard-coding it. Note that the two true-colour branches build their value as `(fg &amp; Attributes.RGB_MASK) &lt;&lt; 8` / `(bg &amp; Attributes.RGB_MASK) &lt;&lt; 8`, which leaves the alpha byte at `0` — so those need a solid alpha first, otherwise every 24-bit background would become transparent instead:
    
    case Attributes.CM_RGB:
      $rgba = ((bg &amp; Attributes.RGB_MASK) &lt;&lt; 8) | 0xFF;
      break;
    ...
    $a = ($rgba &amp; 0xFF) / 255;

I&#39;m carrying exactly that as a local patch and it fixes the artifact with no effect on opaque themes or true-colour backgrounds.

A possible alternative, if the intent was that attribute-only `bg` values shouldn&#39;t produce a rectangle at all, is to mask the colour bits in the `updateBackgrounds()` condition — but the alpha handling looks like a bug independently of that.

Reactions are currently unavailable</excerpt>
</source>
<source kind="search">
<title>@xterm/addon-webgl - npm</title>
<location>https://www.npmjs.com/package/%40xterm/addon-webgl?activeTab=versions</location>
<excerpt>citeturn0search2 [wordlim: 200] Crawled: today; 0.20.0-beta.300  | 168,212  | 2 months ago ... `npm i @xterm/addon-webgl` ... github.com/xtermjs/xterm.js/tree/master

## Versions

### Current Tags

Version  | Downloads (Last 7 Days)  | Tag
--- | --- | ---
0.20.0-beta.319  | 0  | beta
0.19.0  | 1,475,478  | latest


### Version History

Version  | Downloads (Last 7 Days)  | Published
--- | --- | ---
0.20.0-beta.319  | 0  | 3 hours ago
0.20.0-beta.318  | 0  | 3 hours ago
0.20.0-beta.317  | 0  | 4 hours ago
0.20.0-beta.316  | 0  | 7 hours ago
0.20.0-beta.315  | 0  | 8 hours ago
0.20.0-beta.314  | 0  | 9 hours ago
0.20.0-beta.313  | 0  | 10 hours ago
0.20.0-beta.312  | 0  | 11 hours ago
0.20.0-beta.311  | 0  | 15 hours ago
0.20.0-beta.310  | 213  | 2 days ago
0.20.0-beta.309  | 11,262  | 16 days ago
0.20.0-beta.308  | 283  | 16 days ago
0.20.0-beta.307  | 5  | 16 days ago
0.20.0-beta.306  | 5  | 16 days ago
0.20.0-beta.305  | 5  | 16 days ago
0.20.0-beta.304  | 5  | 16 days ago
0.20.0-beta.303  | 4  | 16 days ago
0.20.0-beta.302  | 4  | 16 days ago
0.20.0-beta.301  | 3  | 16 days ago
0.20.0-beta.300  | 168,212  | 2 months ago
0.20.0-beta.299  | 22,509  | 2 months ago
0.20.0-beta.298  | 3,569  | 3 months ago
0.20.0-beta.297  | 364  | 3 months ago
0.20.0-beta.296  | 0  | 3 months ago
0.20.0-beta.295  | 0  | 3 months ago
0.20.0-beta.294  | 0  | 3 months ago
0.20.0-beta.293  | 0  | 3 months ago
0.20.0-beta.292  | 63  | 3 months ago
0.20.0-beta.291  | 42,796  | 3 months ago
0.20.0-beta.290  | 24,566  | 3 months ago
0.20.0-beta.289  | 2,997  | 3 months ago
0.20.0-beta.288  | 1,232  | 4 months ago
0.20.0-beta.287  | 2,330  | 4 months ago
0.20.0-beta.286  | 63,857  | 5 months ago
0.20.0-beta.285  | 0  | 5 months ago
0.20.0-beta.284  | 2,567  | 5 months ago
0.20.0-beta.283  | 0  | 5 months ago
0.20.0-beta.282  | 0  | 5 months ago
0.20.0-beta.281  | 0  | 5 months ago
0.20.0-beta.280  | 0  | 5 months ago
0.20.0-beta.279  | 0  | 5 months ago
0.20.0-beta.278  | 0  | 5 months ago
0.20.0-beta.277  | 0  | 5 months ago
0.20.0-beta.276  | 0  | 5 months ago
0.20.0-beta.275  | 10  | 5 months ago
0.20.0-beta.274  | 0  | 5 months ago
0.20.0-beta.273  | 1  | 5 months ago
0.20.0-beta.272  | 0  | 5 months ago
0.20.0-beta.271  | 0  | 5 months ago
0.20.0-beta.270  | 0  | 5 months ago
0.20.0-beta.65  | 0  | 10 months ago
0.20.0-beta.64  | 0  | 10 months ago
0.20.0-beta.63  | 0  | 10 months ago
0.20.0-beta.62  | 0  | 10 months ago
0.20.0-beta.61  | 0  | 10 months ago
0.20.0-beta.60  | 0  | 10 months ago
0.20.0-beta.59  | 0  | 10 months ago
0.20.0-beta.58  | 0  | 10 months ago
0.20.0-beta.57  | 0  | 10 months ago
0.20.0-beta.56  | 0  | 10 months ago
0.20.0-beta.55  | 9  | 10 months ago
0.20.0-beta.54  | 0  | 10 months ago
0.20.0-beta.53  | 0  | 10 months ago
0.20.0-beta.52  | 0  | 10 months ago
0.20.0-beta.51  | 0  | 10 months ago
0.20.0-beta.50  | 0  | 10 months ago
0.20.0-beta.49  | 0  | 10 months ago
0.20.0-beta.48  | 0  | 10 months ago
0.20.0-beta.47  | 0  | 10 months ago
0.20.0-beta.46  | 0  | 10 months ago
0.20.0-beta.45  | 0  | 10 months ago
0.20.0-beta.44  | 0  | 10 months ago
0.20.0-beta.43  | 0  | 10 months ago
0.20.0-beta.42  | 0  | 10 months ago
0.20.0-beta.41  | 0  | 10 months ago
0.20.0-beta.40  | 0  | 10 months ago
0.20.0-beta.39  | 0  | 10 months ago
0.20.0-beta.38  | 0  | 10 months ago
0.20.0-beta.37  | 0  | 10 months ago
0.20.0-beta.36  | 0  | 10 months ago
0.20.0-beta.35  | 0  | 10 months ago
0.20.0-beta.34  | 0  | 10 months ago
0.20.0-beta.33  | 0  | 10 months ago
0.20.0-beta.32  | 0  | 10 months ago
0.20.0-beta.31  | 1  | 10 months ago
0.20.0-beta.30  | 0  | 10 months ago
0.20.0-beta.29  | 0  | 10 months ago
0.20.0-beta.28  | 0  | 10 months ago
0.20.0-beta.27  | 0  | 10 months ago
0.20.0-beta.5  | 3  | 10 months ago
0.20.0-beta.4  | 0  | 10 months ago
0.20.0-beta.3  | 0  | 10 months ago
0.20.0-beta.2  | 0  | 10 months ago
0.20.0-beta.1  | 0  | 10 months ago
0.19.0  | 1,475,478  | 10 months ago
0.19.0-beta.143  | 1  | 10 months ago
0.19.0-beta.142  | 0  | 10 months ago
0.19.0-beta.141  | 0  | 10 months ago
0.19.0-beta.140  | 40  | a year ago
0.19.0-beta.139  | 0  | a year ago
0.19.0-beta.138  | 0  | a year ago
0.19.0-beta.137  | 44  | a year ago
0.19.0-beta.136  | 471  | a year ago
0.19.0-beta.135  | 33  | a year ago
0.19.0-beta.134  | 0  | a year ago
0.19.0-beta.133  | 0  | a year ago
0.19.0-beta.132  | 0  | a year ago
0.19.0-beta.131  | 35  | a year ago
0.19.0-beta.130  | 0  | a year ago
0.19.0-beta.129  | 6  | a year ago
0.19.0-beta.128  | 0  | a year ago
</excerpt>
</source>
<source kind="search">
<title>UNPKG</title>
<location>https://app.unpkg.com/%40xterm/addon-webgl%400.19.0/files/src</location>
<excerpt>citeturn0search3 [wordlim: 200] Crawled: 2 weeks ago; An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables a WebGL2-based renderer. ...  | RectangleRenderer.ts  | 13.8 kB

# @xterm/addon-webgl

Version: [Select]

An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables a WebGL2-based renderer. This addon requires xterm.js v4+.

@xterm/addon-webgl / src 1 folder, 16 files
 | ../
 | renderLayer/  | 12.5 kB
 | CellColorResolver.ts  | 10 kB
 | CharAtlasCache.ts  | 3.15 kB
 | CharAtlasUtils.ts  | 3.33 kB
 | Constants.ts  | 548 B
 | CursorBlinkStateManager.ts  | 4.88 kB
 | CustomGlyphs.ts  | 36.6 kB
 | DevicePixelObserver.ts  | 1.6 kB
 | GlyphRenderer.ts  | 16.9 kB
 | RectangleRenderer.ts  | 13.8 kB
 | RenderModel.ts  | 1.25 kB
 | TextureAtlas.ts  | 46.4 kB
 | TypedArray.ts  | 989 B
 | Types.ts  | 3.57 kB
 | WebglAddon.ts  | 4.67 kB
 | WebglRenderer.ts  | 28.6 kB
 | WebglUtils.ts  | 1.86 kB</excerpt>
</source>
<source kind="search">
<title>Releases · xtermjs/xterm.js · GitHub</title>
<location>https://github.com/xtermjs/xterm.js/releases</location>
<excerpt>citeturn0search1 [wordlim: 200] Crawled: 2 days ago;   * #5143 Publish commit and set peerDependencies to @xterm/xterm beta when publishing ...     * ⚠️ This is a breaking change, this addon no longer exists and we recommend using either the DOM renderer or WebGL ... `@xterm/addon-webgl`  | `0.17.0`
  * #5148 Bump micromatch from 4.0.5 to 4.0.8
  * #5143 Publish commit and set peerDependencies to @xterm/xterm beta when publishing
  * #5141 Bump webpack from 5.88.2 to 5.94.0
  * #5140 Add Filet Cloud to Real-world uses
  * #5136 Fix description for WebglAddon class in @xterm/addon-webgl
  * #5130 Remove xterm- prefix from addon mjs output
  * #5124 Update node-pty, use conpty.dll
  * #5106 Move to vs/base disposables
  * #5105 Remove the canvas renderer
    * ⚠️ This is a breaking change, this addon no longer exists and we recommend using either the DOM renderer or WebGL
  * #5104 Remove EventEmitter in favor of vs/base/common/event&#39;s Emitter
  * #5103 remove _workCell in InputHandler.
  * #5095 Remove procfile
  * #5094 Add build flow images and move logo into new images folder
  * #5093 Align npm and test script names
  * #5091 Ignore EPIPE exception on Windows when reloading demo client
  * Re-search when options change (#4831) via @tisilent

### @xterm/addon-serialize

  * Fix hex color serialization (#4833) via @arcanis
  * Add ability to serialize via a range (#4877) via @Tyriar

### @xterm/addon-webgl

  * Add underline variants to make underline patterns appear correctly (#4703) via @tisilent
  * Improve rendering of dashed underline patterns (#4874) via @tisilent
  * Fix inactive cursor rendering (#4801) via @tisilent
  * Allow addon to work on legacy versions of Safari when webgl2 is explicitly enabled (#4836) via @xiaoxiaobt
  * Support blending of selection and background/powerline characters and the selection (#4920, #4950) via @Tyriar

### @xterm/addon-web-links

  * Fix url parsing for urls with percentage sign (#4937) via @szymonkaliski
  * Fix uppercase url parsing (#4965) via @jerch

## 🎉 New real-world use cases

  * cloudtutor.io (#4570) via @naufalafif
  * Helix Editor Playground (#4585) via @tomgroenwoldt
  * Coder (#4595) via @matifali

* * *

## 📥 Addons

### xterm-addon-canvas

  * Add getRasterizedGlyph null and undefined check (#4596) via @lewis-sanchez
  * Fix various underlines by rendering them upwards (#4648, #4664) via @tisilent

### xterm-addon-image

  * The images addon has been merged into the main repository (#4577, #4727) via @jerch

### xterm-addon-ligatures

  * Enable the ligatures addon on Electron (#4387) via @LabhanshAgrawal

### xterm-addon-serialize

  * Fallback to default ANSIcolors when running xterm-headless (#4348) via @silamon

### xterm-addon-webgl

  * Render the cursor in the WebGL canvas (#4568) via @xzfc

## 🤝 Compatible addon versions

Addon  | Version
--- | ---
`xterm-addon-attach`  | `0.9.0`
`xterm-addon-canvas`  | `0.5.0`
`xterm-addon-fit`  | `0.8.0`
`xterm-addon-image`  | `0.5.0`
`xterm-addon-ligatures`  | `0.7.0`
`xterm-addon-search`  | `0.13.0`
`xterm-addon-serialize`  | `0.11.0`
`xterm-addon-unicode11`  | `0.6.0`
`xterm-addon-web-links`  | `0.9.0`
`xterm-addon-webgl`  | `0.16.0`


### xterm-addon-webgl

  * Fix glyphs becoming garbled or invisible (#4180, #4181) via @Tyriar
  * Share texture atlases between the webgl and canvas renderers (#4170, #4168, #4182) via @Tyriar
  * Enable the webgl renderer on safari 16 and above (#4255) via @Tyriar
  * Fixes disappearance of characters in webgl renderer (#4271) via @jeanp413
  * Fix NPE in webgl renderer (#4326) via @Tyriar

### xterm-addon-web-links

  * Major rework of the addon (#4288) via @jerch. This adds support for more URLs, fixes underlines sometimes being incorrect and changes the regex. There will be regressions in previous behavior with this but overall it&#39;s in a much better state. If you find any problems please report them to us.
  * Add 1024 character limit (#4251) via @Tyriar

## 🤝 Compatible addon versions

  * `[email protected]`
  * `[email protected]`
  * `[email protected]`
  * `[email protected]`
  * `[email protected]`
  * `[email protected]`
  * `[email protected]`
  * `[email protected]`

### Contributors

  *   *   *   *   *   *   *   *   *   *   *   *   * dstein64, coderaiser, and 11 other contributors

## 5.0.0

5.0.0

Compare


## 📥 Addons

### xterm-addon-canvas

  * Redraw selection on resize (#3938) via @Tyriar
  * Fix rendering of the `▛` (U+259B) character (#3902) via @Tyriar
  * Fix blurry rendering that could happen when using a non-round devicePixelRatio (#3926, #4009, #4105) via @Tyriar, @jeanp413
  * Overdraw powerline strokes such that the top and bottom are flat against the cell boundaries (#4070) via @Tyriar
  * Show entire glyph for extra powerline symbols (#4073, #4086) via @Tyriar

### xterm-addon-fit

  * Fix return type of `proposeDimensions` to include `undefined` (#3882) via @jerch

### xterm-addon-ligatures

  * Warn when ligature fonts fail to download (#3933) via @Tyriar
  * Fix the addon in the latest version of Chrome (#3936) via @Tyriar
  * Fallback ligatures are now supported, allowing ligatures to work without font access (#3963) via @Tyriar
  * Remove electron renderer and node targets (#4002, #4003) via @Tyriar

### xterm-addon-web-links

  * The link matcher-based implementation has been removed in favor of the link provider implementation (#3944) via @Tyriar

### xterm-addon-webgl

More efficient GPU memory usage using new texture atlas packing strategy (#3979) via @Tyriar

The previous naive texture packing strategy which only allowed adding to the &quot;active row&quot; or below has been replaced with a new strategy that uses multiple active rows and adds glyphs to the most suitable row based on its pixel height. This leads to more effective usage of the texture xterm.js uploads to the GPU, meaning it&#39;s harder to reset the texture when it becomes filled (which is more likely to happen when screen scale is high).

Before:

After:

Other changes

  * Release webgl resources when the addon is disposed (#3890) via...

Read more
## 📥 Addons

### xterm-addon-search

  * Support showing all find matches by leveraging decorations (#3698, #3707, #3708, #3709, #3710, #3736, #3750, #3757, #3767, #3768, #3811, #3835) via @meganrogge, @Tyriar
  * Return the number of results when searching (#3716, #3731, #3745, #3752, #3793, #3831, #3874) via @meganrogge
  * Allow external styling of the active result decoration via `.xterm-find-active-result-decoration` (#3802) via @Tyriar

### xterm-addon-serialize

  * Restore cursor style during serialize (#3682) via @Tyriar

### xterm-addon-web-links

  * Expose `urlRegex` in public API (#3719) via @LuckyGeck
  * Handle wrapped lines properly (#3718) via @LuckyGeck

### xterm-addon-webgl

  * Simplified and sped up selection rendering by leveraging the decorations feature (#3782, #3860) via @Tyriar

## 🤝 Compatible addon versions

  * `[email protected]`
  * `[email protected]`
  * `[email protected]`
  * `[email protected]`
  * `[email protected]`
  * `[email protected]`
  * `[email protected]`
  * `[email protected]`
</excerpt>
</source>
<source kind="search">
<title>@xterm/addon-webgl - npm</title>
<location>https://www.npmjs.com/package/%40xterm/addon-webgl</location>
<excerpt>citeturn0search4 [wordlim: 200] Crawled: 2 weeks ago; 0.19.0 • Public • Published 10 months ago ...   * Code Beta ... An addon for xterm.js that enables a WebGL2-based renderer. ... github.com/xtermjs/xterm.js/tree/master

# @xterm/addon-webgl

Image: This package contains built-in TypeScript declarations

0.19.0 • Public • Published 10 months ago

  * Readme
  * Code Beta
  * 0 Dependencies
  * 179 Dependents
  * 501 Versions

## @xterm/addon-webgl

An addon for xterm.js that enables a WebGL2-based renderer. This addon requires xterm.js v4+.

### Install
    
    npm install --save @xterm/addon-webgl

### Usage
    
    import { Terminal } from &#39;@xterm/xterm&#39;;
    import { WebglAddon } from &#39;@xterm/addon-webgl&#39;;
    
    const terminal = new Terminal();
    terminal.open(element);
    terminal.loadAddon(new WebglAddon());

See the full API for more advanced usage.

### Handling Context Loss

The browser may drop WebGL contexts for various reasons like OOM or after the system has been suspended. There is an API exposed that fires the `webglcontextlost` event fired on the canvas so embedders can handle it however they wish. An easy, but suboptimal way, to handle this is by disposing of WebglAddon when the event fires:
    
    const terminal = new Terminal();
    const addon = new WebglAddon();
    addon.onContextLoss(e =&gt; {
      addon.dispose();
    });
    terminal.loadAddon(addon);

Read more about handling WebGL context losses on the Khronos wiki.

## Readme

### Keywords

  * terminal
  * webgl
  * xterm

## Package Sidebar

### Install

`npm i @xterm/addon-webgl`

### Repository

github.com/xtermjs/xterm.js/tree/master

### Homepage

github.com/xtermjs/xterm.js/tree/master#readme

### Weekly Downloads

1,424,303

### Version

0.19.0

### License

MIT

### Last publish

a day ago

### Collaborators

  * tyriar
</excerpt>
</source>
<omitted_sources count="10">Additional source records were omitted from this bounded result.</omitted_sources>
</source_evidence>

Citations:

- 1: https://www.npmjs.com/package/%40xterm/addon-webgl?activeTab=versions&utm_source=openai
- 2: GitHub issue 6116 in xtermjs/xterm.js (link omitted to avoid creating a cross-reference)
- 3: https://app.unpkg.com/%40xterm/addon-webgl%400.19.0/files/src?utm_source=openai

Script executed:

printf '%s\n' '--- locate exact patch/dependency files ---'
find config/patches -type f | sort | grep -Ei 'xterm|webgl' || true
rg -n -i -C 12 -- 'clear(Color|ColorBuffer)|clearColor|RectangleRenderer|updateBackgrounds|default.?background|rgba|alpha|allowTransparency|transparent' config/patches || true
printf '%s\n' '--- dependency metadata ---'
rg -n -C 5 -- '@xterm/(addon-webgl|xterm)|addon-webgl|0\.20\.0-beta\.300' package.json pnpm-lock.yaml config 2>/dev/null || true
printf '%s\n' '--- terminal appearance and addon flow ---'
rg -n -C 10 -- 'allowTransparency|WebglAddon|webgl|Window Blur|windowBlur|window-blur|transparent' src/renderer/src src/main | head -700 || true

Repository: stablyai/orca

Length of output: 45657


Script executed:

set -o pipefail
printf '%s\n' '--- exact WebGL patch hunk headers and changed lines ---'
rg -n -C 6 -- '^(@@|diff --git|[-+].*(clear|background|Rectangle|alpha|rgba|transparent|allowTransparency|updateBackground))' \
  config/patches/@[email protected] \
  config/patches/@[email protected]
printf '%s\n' '--- upstream mapping and dependency declarations ---'
cat config/patches/xterm-upstream.json
rg -n -C 5 -- '@xterm/(addon-webgl|xterm)|0\.20\.0-beta\.300' package.json pnpm-lock.yaml
printf '%s\n' '--- terminal appearance complete relevant blocks ---'
nl -ba src/renderer/src/components/terminal-pane/terminal-appearance.ts | sed -n '55,95p;150,195p'
printf '%s\n' '--- WebGL guard and attach block ---'
nl -ba src/renderer/src/lib/pane-manager/pane-webgl-renderer.ts | sed -n '1,90p;210,305p'
printf '%s\n' '--- WebGL enablement settings/definition ---'
rg -n -C 10 -- 'ENABLE_WEBGL_RENDERER|gpuRenderingEnabled|shouldUseTerminalWebgl|terminalGpuAcceleration' \
  src/renderer/src/lib/pane-manager src/renderer/src/components/terminal-pane src/renderer/src | head -320

Repository: stablyai/orca

Length of output: 45666


Script executed:

python3 - <<'PY'
import io, json, tarfile, urllib.request
urls = [
  'https://registry.npmjs.org/@xterm/addon-webgl/-/addon-webgl-0.20.0-beta.300.tgz',
  'https://registry.npmjs.org/@xterm/xterm/-/xterm-6.1.0-beta.304.tgz',
]
for url in urls:
    print('\\n---', url, '---')
    try:
        data = urllib.request.urlopen(url, timeout=20).read()
        print('bytes', len(data))
        with tarfile.open(fileobj=io.BytesIO(data), mode='r:gz') as tf:
            names = tf.getnames()
            for name in names:
                low = name.lower()
                if any(x in low for x in ('rectanglerenderer', 'webglrenderer', 'renderlayer', 'theme-service', 'webgladdon')):
                    print('FILE', name)
                    text = tf.extractfile(name).read().decode('utf-8', 'replace')
                    lines = text.splitlines()
                    for i, line in enumerate(lines, 1):
                        if any(k.lower() in line.lower() for k in ('clearcolor','clear_color','clear(gl','updatebackground','defaultbackground','background.rgba','allowtransparency','alpha =','_a =','rgba =')):
                            lo=max(1,i-8); hi=min(len(lines),i+12)
                            print(f'-- {name}:{lo}-{hi} --')
                            for j in range(lo,hi+1):
                                print(f'{j}: {lines[j-1]}')
    except Exception as e:
        print(type(e).__name__, e)
PY

Repository: stablyai/orca

Length of output: 10558


Script executed:

set -o pipefail
printf '%s\n' '--- patch source hunks ---'
awk 'BEGIN{p=0} /^diff --git/{p=($0 ~ /addon-webgl/)} p{print NR ":" $0}' config/patches/@[email protected] | sed -n '1,260p'
printf '%s\n' '--- exact patch file changed-line search ---'
grep -n -E 'clearColor|clear\(|RectangleRenderer|updateBackground|background|alpha|rgba|transparent|allowTransparency' config/patches/@[email protected] || true
printf '%s\n' '--- package metadata ---'
rg -n -C 4 -- '@xterm/(addon-webgl|xterm)|0\.20\.0-beta\.300' package.json pnpm-lock.yaml
printf '%s\n' '--- appearance ---'
nl -ba src/renderer/src/components/terminal-pane/terminal-appearance.ts | sed -n '60,90p;165,185p'
printf '%s\n' '--- attach ---'
nl -ba src/renderer/src/lib/pane-manager/pane-webgl-renderer.ts | sed -n '1,70p;212,305p'

Repository: stablyai/orca

Length of output: 24295


Script executed:

set -o pipefail
printf '%s\n' '--- correct WebGL source patch ---'
nl -ba config/patches/xterm-src/@[email protected] | sed -n '1,260p'
printf '%s\n' '--- beta.300 renderer blocks from npm tarball ---'
python3 - <<'PY'
import io, tarfile, urllib.request
url='https://registry.npmjs.org/@xterm/addon-webgl/-/addon-webgl-0.20.0-beta.300.tgz'
data=urllib.request.urlopen(url, timeout=20).read()
with tarfile.open(fileobj=io.BytesIO(data), mode='r:gz') as tf:
    for wanted in ('package/src/RectangleRenderer.ts','package/src/WebglRenderer.ts','package/src/renderLayer/BaseRenderLayer.ts'):
        text=tf.extractfile(wanted).read().decode()
        lines=text.splitlines()
        print('\\n---', wanted, '---')
        if wanted.endswith('RectangleRenderer.ts'):
            ranges=[(185,315),(313,365)]
        elif wanted.endswith('WebglRenderer.ts'):
            ranges=[(120,220),(300,390),(520,625)]
        else:
            ranges=[(1,115)]
        for lo,hi in ranges:
            print(f'[{lo}-{hi}]')
            for i in range(lo,min(hi,len(lines))+1):
                print(f'{i}: {lines[i-1]}')
PY
printf '%s\n' '--- terminal creation and appearance callers ---'
rg -n -C 12 -- 'new Terminal|applyTerminalAppearance|updateTerminalAppearance|setTerminalAppearance|terminal-appearance' src/renderer/src/components/terminal-pane src/renderer/src/lib/pane-manager | head -500
printf '%s\n' '--- Linux blur call and split background ---'
rg -n -C 10 -- 'windowBackgroundBlur|splitBackground|paneBackground|terminalBackgroundOpacity|backgroundOpacity' \
  src/renderer/src/components src/renderer/src/lib src/renderer/src/assets src/main/window | head -500

Repository: stablyai/orca

Length of output: 42298


Script executed:

set -o pipefail
printf '%s\n' '--- beta.300 RectangleRenderer initialization and WebGL render ---'
python3 - <<'PY'
import io, tarfile, urllib.request
url='https://registry.npmjs.org/@xterm/addon-webgl/-/addon-webgl-0.20.0-beta.300.tgz'
with tarfile.open(fileobj=io.BytesIO(urllib.request.urlopen(url, timeout=20).read()), mode='r:gz') as tf:
  for wanted, ranges in [
    ('package/src/RectangleRenderer.ts', [(1,65),(100,198)]),
    ('package/src/WebglRenderer.ts', [(85,125),(218,310),(430,515)])
  ]:
    text=tf.extractfile(wanted).read().decode()
    lines=text.splitlines()
    print('\\n---', wanted, '---')
    for lo,hi in ranges:
      print(f'[{lo}-{hi}]')
      for i in range(lo,min(hi,len(lines))+1):
        print(f'{i}: {lines[i-1]}')
PY
printf '%s\n' '--- xterm transparency propagation in exact dependency ---'
python3 - <<'PY'
import io, tarfile, urllib.request
url='https://registry.npmjs.org/@xterm/xterm/-/xterm-6.1.0-beta.304.tgz'
with tarfile.open(fileobj=io.BytesIO(urllib.request.urlopen(url, timeout=20).read()), mode='r:gz') as tf:
  for name in tf.getnames():
    if name.startswith('package/src/') and name.endswith('.ts'):
      text=tf.extractfile(name).read().decode('utf-8','replace')
      if 'allowTransparency' in text or '_setTransparency' in text:
        print('\\n---',name,'---')
        lines=text.splitlines()
        for i,line in enumerate(lines,1):
          if 'allowTransparency' in line or '_setTransparency' in line:
            for j in range(max(1,i-8),min(len(lines),i+14)+1):
              print(f'{j}: {lines[j-1]}')
PY
printf '%s\n' '--- live pane background and appearance caller ---'
rg -n -F -- 'applyRootBackground' src/renderer/src
rg -n -F -- 'splitBackground:' src/renderer/src
rg -n -F -- 'paneBackground:' src/renderer/src
rg -n -F -- 'applyTerminalAppearance' src/renderer/src
rg -n -C 8 -- 'composeActiveTerminalTheme|paneBackground|splitBackground|terminal-appearance' \
  src/renderer/src/components/terminal-pane src/renderer/src/lib/pane-manager | head -400

Repository: stablyai/orca

Length of output: 41690


Script executed:

python3 - <<'PY'
import io, tarfile, urllib.request
url='https://registry.npmjs.org/@xterm/addon-webgl/-/addon-webgl-0.20.0-beta.300.tgz'
with tarfile.open(fileobj=io.BytesIO(urllib.request.urlopen(url, timeout=20).read()), mode='r:gz') as tf:
  for wanted in ('package/src/RectangleRenderer.ts','package/src/WebglRenderer.ts'):
    text=tf.extractfile(wanted).read().decode()
    lines=text.splitlines()
    print('\\n---',wanted,'---')
    for i,line in enumerate(lines,1):
      if ('_colorToFloat32Array' in line or 'enable(' in line or 'blendFunc' in line or 'blendEquation' in line or 'clearColor' in line or 'clear(' in line):
        for j in range(max(1,i-5), min(len(lines),i+8)+1):
          print(f'{j}: {lines[j-1]}')
PY

Repository: stablyai/orca

Length of output: 3728


Make the WebGL background layer transparent.

With terminal opacity below 1 and WebGL enabled, @xterm/[email protected] still draws the theme background into its canvas. Its viewport-clear rectangle uses colors.background, which already contains the configured opacity. The CSS rule does not affect this canvas, so the split root and WebGL canvas can compound the background. Attribute-only italic or dim cells can also create opaque default-background rectangles because RectangleRenderer forces their alpha to 1.

Extend the existing WebGL patch to use a transparent viewport rectangle and ignore attribute-only default-background cells.

Suggested fix
diff --git a/src/RectangleRenderer.ts b/src/RectangleRenderer.ts
@@
-    this._bgFloat = this._colorToFloat32Array(colors.background);
+    this._bgFloat = new Float32Array([0, 0, 0, 0]);
@@
-          if (currentBg !== 0 || (currentInverse && currentFg !== 0)) {
+          if ((currentBg & Attributes.CM_MASK) !== Attributes.CM_DEFAULT || (currentInverse && currentFg !== 0)) {
@@
-      if (currentBg !== 0 || (currentInverse && currentFg !== 0)) {
+      if ((currentBg & Attributes.CM_MASK) !== Attributes.CM_DEFAULT || (currentInverse && currentFg !== 0)) {

@nwparker

nwparker commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Closing as superseded by #36580, which adds Opaque, Translucent and Blurred window materials on macOS, Windows and Linux (plus Reduce Visual Effects) and fixes the transparent-terminal flicker. Thank you for this PR, it shaped the design.

@nwparker nwparker closed this Nov 2, 2026
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.

[Bug]: Background Opacity and Window Blur have no visible effect on Linux

2 participants