feat: add restart and reload menu items on macOS (#9212)
This commit is contained in:
parent
01b12949e3
commit
c365f0a7c1
1 changed files with 13 additions and 0 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
import { Menu, MenuItem, PredefinedMenuItem, Submenu } from "@tauri-apps/api/menu"
|
import { Menu, MenuItem, PredefinedMenuItem, Submenu } from "@tauri-apps/api/menu"
|
||||||
import { type as ostype } from "@tauri-apps/plugin-os"
|
import { type as ostype } from "@tauri-apps/plugin-os"
|
||||||
|
import { invoke } from "@tauri-apps/api/core"
|
||||||
|
import { relaunch } from "@tauri-apps/plugin-process"
|
||||||
|
|
||||||
import { runUpdater, UPDATER_ENABLED } from "./updater"
|
import { runUpdater, UPDATER_ENABLED } from "./updater"
|
||||||
import { installCli } from "./cli"
|
import { installCli } from "./cli"
|
||||||
|
|
@ -24,6 +26,17 @@ export async function createMenu() {
|
||||||
action: () => installCli(),
|
action: () => installCli(),
|
||||||
text: "Install CLI...",
|
text: "Install CLI...",
|
||||||
}),
|
}),
|
||||||
|
await MenuItem.new({
|
||||||
|
action: async () => window.location.reload(),
|
||||||
|
text: "Reload Webview",
|
||||||
|
}),
|
||||||
|
await MenuItem.new({
|
||||||
|
action: async () => {
|
||||||
|
await invoke("kill_sidecar").catch(() => undefined)
|
||||||
|
await relaunch().catch(() => undefined)
|
||||||
|
},
|
||||||
|
text: "Restart",
|
||||||
|
}),
|
||||||
await PredefinedMenuItem.new({
|
await PredefinedMenuItem.new({
|
||||||
item: "Separator",
|
item: "Separator",
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue