Skip to content

Commit

Permalink
Try using native cut/copy/paste
Browse files Browse the repository at this point in the history
  • Loading branch information
hatchan committed Oct 2, 2024
1 parent d1ecaf2 commit d488624
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions fpx-app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use anyhow::{Context, Result};
use api_manager::ApiManager;
use state::AppState;
use std::env;
use tauri::menu::{MenuId, MenuItemBuilder};
use tauri::menu::{MenuBuilder, MenuId, MenuItemBuilder, SubmenuBuilder};
use tauri::{Emitter, WebviewWindowBuilder};
use tauri::{Manager, Wry};
use tauri_plugin_store::StoreCollection;
Expand Down Expand Up @@ -51,15 +51,21 @@ fn main() {
.build(app)
.unwrap();

let items = app.menu().unwrap().items().unwrap();
for item in items {
let item = item.as_submenu().unwrap();
let name = item.text().unwrap();
if name == "File" {
item.append_items(&[&open_workspace, &close_workspace])
.unwrap();
}
}
let app_menu = SubmenuBuilder::new(app, "App")
.item(&open_workspace)
.item(&close_workspace)
.separator()
.cut()
.copy()
.paste()
.separator()
.close_window()
.build()
.unwrap();

let menu = MenuBuilder::new(app).items(&[&app_menu]).build().unwrap();

app.set_menu(menu).unwrap();

let window = WebviewWindowBuilder::new(
app,
Expand Down

0 comments on commit d488624

Please sign in to comment.