Files
hoppscotch/packages/hoppscotch-selfhost-desktop/src-tauri/src/main.rs
Andrew Bastin 16044b5840 feat: desktop app
Co-authored-by: Vivek R <123vivekr@gmail.com>
Co-authored-by: Liyas Thomas <liyascthomas@gmail.com>
2023-11-07 14:20:03 +05:30

53 lines
1.5 KiB
Rust

// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
#[cfg(target_os = "macos")]
#[macro_use]
extern crate cocoa;
#[cfg(target_os = "macos")]
#[macro_use]
extern crate objc;
#[cfg(target_os = "macos")]
mod mac;
#[cfg(target_os = "windows")]
mod win;
use tauri::Manager;
fn main() {
tauri_plugin_deep_link::prepare("io.hoppscotch.desktop");
tauri::Builder::default()
.plugin(tauri_plugin_window_state::Builder::default().build())
.plugin(tauri_plugin_store::Builder::default().build())
.setup(|app| {
if cfg!(target_os = "macos") {
#[cfg(target_os = "macos")]
use mac::window::setup_mac_window;
#[cfg(target_os = "macos")]
setup_mac_window(app);
} else if cfg!(target_os = "windows") {
#[cfg(target_os = "windows")]
use win::window::setup_win_window;
#[cfg(target_os = "windows")]
setup_win_window(app);
}
let handle = app.handle();
tauri_plugin_deep_link::register("hoppscotch", move |request| {
println!("{:?}", request);
handle.emit_all("scheme-request-received", request).unwrap();
})
.unwrap();
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}