Skip to content

Commit

Permalink
fix: Mac において Cmd + V 等のショートカットキーを利用可能にする (#704)
Browse files Browse the repository at this point in the history
* ネイティブメニューの設定を通してMacでショートカットキー対応

* add comments

* createMenu関数の追加をやめ、元の処理の流れに近い形でメニューを設定
  • Loading branch information
PickledChair authored Feb 20, 2022
1 parent 788dedf commit 00c80e8
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,29 @@ async function createWindow() {
});
}

if (!isDevelopment) {
Menu.setApplicationMenu(null);
const menuTemplateForMac: Electron.MenuItemConstructorOptions[] = [
{
label: "VOICEVOX",
submenu: [{ role: "quit" }],
},
{
label: "Edit",
submenu: [
{ role: "cut" },
{ role: "copy" },
{ role: "paste" },
{ role: "selectAll" },
],
},
];

// For macOS, set the native menu to enable shortcut keys such as 'Cmd + V'.
if (isMac) {
Menu.setApplicationMenu(Menu.buildFromTemplate(menuTemplateForMac));
} else {
if (!isDevelopment) {
Menu.setApplicationMenu(null);
}
}

// プロセス間通信
Expand Down

0 comments on commit 00c80e8

Please sign in to comment.