dioxus/examples/shortcut.rs
2024-01-15 14:27:20 -08:00

14 lines
271 B
Rust

use dioxus::prelude::*;
use dioxus_desktop::use_global_shortcut;
fn main() {
dioxus_desktop::launch(app);
}
fn app() -> Element {
let toggled = use_signal(|| false);
use_global_shortcut("ctrl+s", move || toggled.toggle());
rsx!("toggle: {toggled}")
}