###electron デフォルトのナビゲーションバーを保持したまま拡張する方法。
electronではデフォルトで以下の画像のようなナビゲーションバー出てくると思います。
ここに出てくるEditなど便利なのでこのまま拡張したいのですが、やりかたがわかりません。
このリンクでは一からナビゲーションを作る方法が解説されていました。がこれをやるとデフォルトのものがなくなって困ってしまいます。
またelectronのMenuの説明も見たのですが、これをコピペしてもisMac
が定義されていませんと出てしまい、デフォルトの機能が適応されてしまいます。
どうすれば拡張できるでしょうか?
どうかご教授いただけるとありがたいです・・・・
以下electronのエントリーポイントです。
main.js
1// Modules to control application life and create native browser window 2const { app, BrowserWindow, Menu } = require("electron"); 3const path = require("path"); 4 5let mainWindow; 6 7function createWindow() { 8 mainWindow = new BrowserWindow({ 9 width: 800, 10 height: 600, 11 webPreferences: { 12 preload: path.join(__dirname, "preload.js") 13 } 14 }); 15 16 mainWindow.loadFile("index.html"); 17 18 mainWindow.on("closed", function() { 19 mainWindow = null; 20 }); 21 //ここでelectron デフォルトのナビゲーションバーを保持したまま拡張したい 22} 23 24app.on("ready", createWindow); 25 26app.on("window-all-closed", function() { 27 // On macOS it is common for applications and their menu bar 28 // to stay active until the user quits explicitly with Cmd + Q 29 if (process.platform !== "darwin") app.quit(); 30}); 31 32app.on("activate", function() { 33 // On macOS it's common to re-create a window in the app when the 34 // dock icon is clicked and there are no other windows open. 35 if (mainWindow === null) createWindow(); 36}); 37 38// In this file you can include the rest of your app's specific main process 39// code. You can also put them in separate files and require them here. 40
あなたの回答
tips
プレビュー