DioxusLabs / DioxusLabs/dioxus

Desktop Window Tranparency Not Rendering Correctly

Open
#3,821 9 comments 1 reaction 0 assignees View on GitHub
bug desktop
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

**Problem**

Dioxus fails to rerender properly when transparency is enabled in desktop mode, leaving the old material underneath the new frame.

**Steps To Reproduce**

```rust
use dioxus::prelude::*;

const STYLES: &'static str = r#"
#body {
display: flex;
}
p {
font-size: 100px;
}
"#;

const IPSUM: &'static str = r#"
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
"#;

const BACON: &'static str = r#"
Bacon ipsum dolor amet jowl pig pork meatball pork belly.
Beef ribs buffalo hamburger burgdoggen. Pig pancetta pastrami
shoulder fatback bacon kevin ham hock doner sirloin prosciutto
t-bone meatloaf. Sausage swine flank pork, spare ribs pork loin
ribeye beef ribs hamburger. Tongue pork chuck, biltong spare ribs
pig jerky salami frankfurter flank drumstick leberkas pork chop
pastrami jowl. Buffalo cupim alcatra tongue prosciutto, pork chop
short ribs pancetta meatloaf corned beef chicken flank sirloin
spare ribs. Boudin meatball andouille tenderloin meatloaf.
"#;

fn gui() -> Element {
let mut scene = use_signal(|| false);

let content = if scene.with(|b| *b) { IPSUM } else { BACON };

rsx! {
style { "{STYLES}" }
div {
id: "body",
onclick: move |_| {
let value = scene.with(|b| *b);
scene.set(!value);
},
p { "{content}" }
}
}
}

fn main() {
let window = dioxus_desktop::WindowBuilder::default()
.with_decorations(false)
.with_transparent(true);
let config = dioxus_desktop::Config::default().with_window(window);

LaunchBuilder::desktop().with_cfg(config).launch(gui);
}
```

**Screenshots**

![Image](https://github.com/user-attachments/assets/6d1f80f2-ab71-4478-9a0c-ac0418e6dff0)

**Environment:**

- Dioxus version: 0.6.3
- Rust version: rustc 1.85.0 (4d91de4e4 2025-02-17)
- OS info: EndeavourOS (Hyprland v0.47.1)
- App platform: Desktop

**Questionnaire**

I'm interested in fixing this myself but don't know where to start.

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.