DioxusLabs / DioxusLabs/dioxus

Window transparency doesn't work

Open
#4,886 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

**Problem**

When I initialize the application with setting the window to be transparent, the background is still white and transparent part only appears on resizing. There was [similar issue in winit](https://github.com/rust-windowing/winit/issues/1290) and they claim that it happening because the application doesn't properly handle the OS request to redraw the window. Also in [tauri there was an issue](https://github.com/tauri-apps/tauri/issues/4881) with a workaround (the workaround changes nothing) which is fixed in newer versions. Please see the issue. There is a video with exactly the same behavior

**Steps To Reproduce**

Steps to reproduce the behavior:

- Create an empty application
- Set window to be transparent

```rust
let window_builder = dioxus::desktop::WindowBuilder::new()
.with_title("Window title")
.with_transparent(true)
.with_always_on_top(false);

dioxus::LaunchBuilder::new()
.with_cfg(
dioxus::desktop::Config::default()
.with_menu(None)
.with_window(window_builder),
)
.launch(App);
```

**Expected behavior**

The application window becomes transparent

**Screenshots**

Please see the linked issues in the description

**Environment:**

- Dioxus version: 0.7.0
- Rust version: 1.91.0
- OS info: Windows 11
- App platform: Desktop

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.