desktop.rs 904 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2019-2023 Tauri Programme within The Commons Conservancy
  2. // SPDX-License-Identifier: Apache-2.0
  3. // SPDX-License-Identifier: MIT
  4. use tauri::WindowBuilder;
  5. pub fn main() {
  6. tauri::Builder::default()
  7. .on_page_load(|window, _payload| {
  8. let label = window.label().to_string();
  9. window.listen("clicked".to_string(), move |_payload| {
  10. println!("got 'clicked' event on window '{label}'");
  11. });
  12. })
  13. .setup(|app| {
  14. #[allow(unused_mut)]
  15. let mut builder = WindowBuilder::new(
  16. app,
  17. "Rust".to_string(),
  18. tauri::WindowUrl::App("index.html".into()),
  19. );
  20. #[cfg(target_os = "macos")]
  21. {
  22. builder = builder.tabbing_identifier("Rust");
  23. }
  24. let _window = builder.title("Tauri - Rust").build()?;
  25. Ok(())
  26. })
  27. .run(tauri::build_script_context!())
  28. .expect("failed to run tauri application");
  29. }