MCPcopy Create free account
hub / github.com/block/buzz / run

Function run

desktop/src-tauri/src/lib.rs:68–666  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

66
67#[cfg_attr(mobile, tauri::mobile_entry_point)]
68pub fn run() {
69 let builder = tauri::Builder::default()
70 .plugin(tauri_plugin_single_instance::init(|app, argv, _cwd| {
71 // Focus the existing window when a duplicate instance launches.
72 if let Some(w) = app.get_webview_window("main") {
73 let _ = w.set_focus();
74 }
75 // Forward any deep link URLs from the duplicate launch.
76 for arg in &argv {
77 if arg.starts_with("buzz://") {
78 handle_deep_link_url(app, arg);
79 }
80 }
81 }))
82 .plugin(tauri_plugin_deep_link::init())
83 .plugin(tauri_plugin_notification::init())
84 .plugin(tauri_plugin_opener::init())
85 .plugin(
86 tauri_plugin_window_state::Builder::default()
87 // The main window should always launch edge-to-edge in the
88 // available desktop area. Do not let stale saved geometry or
89 // fullscreen state override the maximized launch config.
90 .with_state_flags(
91 StateFlags::all()
92 & !(StateFlags::VISIBLE
93 | StateFlags::POSITION
94 | StateFlags::SIZE
95 | StateFlags::MAXIMIZED
96 | StateFlags::FULLSCREEN),
97 )
98 .build(),
99 )
100 .plugin(tauri_plugin_websocket::init())
101 .plugin(tauri_plugin_dialog::init())
102 .plugin(tauri_plugin_process::init());
103
104 // The global-shortcut plugin is omitted from test builds: linking it into
105 // the lib-test binary makes it fail to load on Windows
106 // (STATUS_ENTRYPOINT_NOT_FOUND) before any test runs.
107 #[cfg(not(test))]
108 let builder = builder.plugin({
109 use tauri_plugin_global_shortcut::ShortcutState;
110
111 // Generation counter for the release delay task. Incremented on
112 // every press — a delayed release only fires if the generation
113 // hasn't changed (i.e. no new press happened during the delay).
114 // This prevents press→release→press within 200 ms from having
115 // the first release clobber the second press.
116 let ptt_press_gen = Arc::new(std::sync::atomic::AtomicU64::new(0));
117
118 tauri_plugin_global_shortcut::Builder::new()
119 .with_handler(move |app, _shortcut, event| {
120 let state = match app.try_state::<AppState>() {
121 Some(s) => s,
122 None => return,
123 };
124
125 // Only act if a huddle is active and mode is PTT.

Callers 1

mainFunction · 0.70

Calls 15

handle_deep_link_urlFunction · 0.85
handle_buzz_mediaFunction · 0.85
build_app_stateFunction · 0.85
run_boot_migrationsFunction · 0.85
run_event_syncFunction · 0.85
spawn_listenerFunction · 0.85
spawn_media_proxyFunction · 0.85
ensure_nestFunction · 0.85
nest_dirFunction · 0.85
resolve_repos_at_bootFunction · 0.85

Tested by

no test coverage detected