borderless.rs 549 B

123456789101112131415161718192021
  1. use dioxus::prelude::*;
  2. use dioxus_desktop::desktop_context::DesktopContext;
  3. fn main() {
  4. dioxus::desktop::launch_cfg(app, |cfg| {
  5. cfg.with_window(|w| {
  6. w.with_title("BorderLess Demo")
  7. .with_decorations(false)
  8. })
  9. });
  10. }
  11. fn app (cx: Scope) -> Element {
  12. let desktop = cx.consume_context::<DesktopContext>().unwrap();
  13. cx.render(rsx!(
  14. div {
  15. style: "background-color: black; height: 20px; width: 100%",
  16. onmousedown: move |_| desktop.drag_window(),
  17. }
  18. ))
  19. }