Skip to content

Commit

Permalink
Finally works
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyagr committed Dec 26, 2024
1 parent 2583b58 commit 40c8689
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions backend-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ use indexmap::IndexMap;
// tokio::sync::Mutex, but the docs suggest only using it if absolutely
// neccessary.
use parking_lot::Mutex;
/*
use tauri::menu::{Menu, MenuEvent, MenuItem, Submenu};
use tauri::window::MenuType;
use tauri::Manager;
*/
// TODO: https://tauri.app/start/migrate/from-tauri-1/#migrate-to-menu-module

type DataMutex = Mutex<Box<dyn DataInterface>>;
Expand Down Expand Up @@ -51,6 +53,7 @@ fn main() {

tauri::Builder::default()
.plugin(tauri_plugin_process::init())
/*
.setup(|app| {
let menu_items = vec![
&MenuItem::new("save", "Save", MenuType::Item, true)
Expand All @@ -68,19 +71,18 @@ fn main() {
true,
)? as &dyn tauri::menu::IsMenuItem<_>,
];

let file_menu = Menu::with_items(app, &menu_items)?;
let menu = Menu::with_items(
app,
&[&Submenu::new("File", file_menu)? as &dyn tauri::menu::IsMenuItem<_>],
)?;

app.set_menu(menu)?;
Ok(())
})
.on_menu_event(|event| {
event.window().emit(event.menu_item_id(), ()).unwrap();
})
*/
.manage(input_mutex)
.invoke_handler(tauri::generate_handler![get_merge_data, save])
.run(tauri::generate_context!())
Expand Down
4 changes: 3 additions & 1 deletion webapp/src/backend_interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ export function to_text(file_entry: FileEntry): string | null {
// Tauri interop

// https://github.com/tauri-apps/tauri/discussions/6119
export const TAURI_BACKEND = "__TAURI__" in globalThis;
// TODO: Can this be replaced with https://github.com/tauri-apps/tauri/discussions/6119#discussioncomment-11666454
// or something less brittle?
export const TAURI_BACKEND = "__TAURI_INTERNALS__" in globalThis;

async function backend_request(
command_name: string,
Expand Down

0 comments on commit 40c8689

Please sign in to comment.