From 0988794b488743415c7c6091f96899d9b71219ff Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Thu, 5 Dec 2024 14:53:14 -0500 Subject: [PATCH] match menu layout on macos --- src/main.js | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/src/main.js b/src/main.js index 6de64c7..975897d 100644 --- a/src/main.js +++ b/src/main.js @@ -1937,6 +1937,11 @@ function addFrame() { function addKeyframe() { actions.addKeyframe.create() } +async function about () { + messageDialog(`Lightningbeam version ${await getVersion()}\nDeveloped by Skyler Lehmkuhl`, + {title: 'About', kind: "info"} + ) +} async function render() { document.querySelector("body").style.cursor = "wait" @@ -2879,6 +2884,28 @@ async function updateMenu() { } else { activeFrame = false } + if (macOS) { + const appSubmenu = await Submenu.new({ + text: 'Lightningbeam', + items: [ + { + text: 'About Lightningbeam', + enabled: true, + action:about + }, + { + text: 'Settings', + enabled: false, + action: () => {} + }, + { + text: 'Quit Lightningbeam', + enabled: true, + action: quit, + }, + ] + }) + } const fileSubmenu = await Submenu.new({ text: 'File', items: [ @@ -3032,17 +3059,17 @@ async function updateMenu() { { text: "About...", enabled: true, - action: async () => { - messageDialog(`Lightningbeam version ${await getVersion()}\nDeveloped by Skyler Lehmkuhl`, - {title: 'About', kind: "info"} - ) - } + action: about } ] -}); + }); + let items = [fileSubmenu, editSubmenu, modifySubmenu, timelineSubmenu, viewSubmenu, helpSubmenu] + if (macOS) { + items.unshift([appSubmenu]) + } const menu = await Menu.new({ - items: [fileSubmenu, editSubmenu, modifySubmenu, timelineSubmenu, viewSubmenu, helpSubmenu], + items: items, }) await (macOS ? menu.setAsAppMenu() : menu.setAsWindowMenu()) }