dioxus/examples/shortcut.rs

15 lines
275 B
Rust
Raw Normal View History

use dioxus::prelude::*;
use dioxus_desktop::use_global_shortcut;
fn main() {
dioxus_desktop::launch(app);
}
fn app() -> Element {
2024-01-14 05:12:21 +00:00
let toggled = use_signal(|| false);
2023-06-30 19:48:25 +00:00
_ = use_global_shortcut("ctrl+s", move || toggled.toggle());
2024-01-15 22:27:20 +00:00
rsx!("toggle: {toggled}")
}