Skip to content

Window transparency & opacity#6338

Draft
Vinci10 wants to merge 4 commits into
fyne-io:developfrom
Vinci10:window_transparency
Draft

Window transparency & opacity#6338
Vinci10 wants to merge 4 commits into
fyne-io:developfrom
Vinci10:window_transparency

Conversation

@Vinci10

@Vinci10 Vinci10 commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Description:

Fixes #181

This PR introduces window transparency (only background) and opacity (entire window: border and content) control to the Fyne framework. New methods are added to the fyne.Window interface:

Window Transparency:

Transparent() bool - Returns whether the window background is transparent
SetTransparent(bool) - Sets window transparency (must be called before Show() or ShowAndRun())

Window Opacity:

Opacity() float32 - Returns the current window opacity
SetOpacity(float32) - Sets window opacity (0.0 = fully transparent, 1.0 = fully opaque)

Implementation Details:

Desktop (GLFW): Full support for both transparency and opacity

  • Uses glfw.TransparentFramebuffer hint for transparency
  • Calls SetOpacity() on the viewport window for opacity control
  • Clear color set to transparent (0,0,0,0) when transparency is enabled

Mobile, WebAssembly, Embedded (no-OS): Stubbed implementation (no-effect)

Changes Included:

  • Added transparent and opacity fields to window structs across all drivers
  • Updated painter to respect transparency setting when clearing
  • Update demo tutorial showing both features
  • Unit tests for GLFW implementation
  • Tested on: Windows and Ubuntu

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

Where applicable:

  • Public APIs match existing style and have Since: line.
  • Any breaking changes have a deprecation path or have been discussed.
  • Check for binary size increases when importing new modules.

@Vinci10 Vinci10 force-pushed the window_transparency branch from a3e8ac9 to 7556770 Compare June 2, 2026 10:31
@Vinci10 Vinci10 force-pushed the window_transparency branch 2 times, most recently from 6ea340d to e2207d5 Compare June 2, 2026 12:33
@coveralls

coveralls commented Jun 2, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 60.265% (-0.07%) from 60.337% — Vinci10:window_transparency into fyne-io:develop

@Vinci10 Vinci10 force-pushed the window_transparency branch from e2207d5 to be9554b Compare June 2, 2026 12:52
@andydotxyz

Copy link
Copy Markdown
Member

This certainly does not belong on fyne.Window as many OS do not support it (as you noted).
Do you know which of the desktop systems not tested should work? (macOS, BSD etc).

As noted in the original issue this will have impact on theme as well, because a transparent window doesn't help when the theme defines a fully opaque background colour.

I can see the use-case for needing transparent areas on a window - but what is the case for controlling opacity, in my experience that is set at the desktop level by the user / window manager.

@andydotxyz

Copy link
Copy Markdown
Member

Noting as well that we have passed 2.8 deadline for features.

@sdassow sdassow added the after-release For when an ongoing release is finished. label Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

after-release For when an ongoing release is finished.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transparent window background

4 participants