diff --git a/lib/menu.ts b/lib/menu.ts index 4a03c67..e224392 100644 --- a/lib/menu.ts +++ b/lib/menu.ts @@ -501,22 +501,7 @@ export async function buildMenu() { menuItems.push(copyMenuItem) } - if (!persistedStoreState.disabledActions?.includes('tray-sync')) { - const syncMenuItem = await MenuItem.new({ - id: 'sync', - text: 'Sync', - action: async () => { - await openWindow({ - name: 'Sync', - url: '/sync', - }) - }, - }) - menuItems.push(syncMenuItem) - } - if (!persistedStoreState.disabledActions?.includes('tray-download')) { - // @ts-ignore added elsewhere const downloadMenuItem = await MenuItem.new({ id: 'download', text: 'Download', @@ -527,10 +512,11 @@ export async function buildMenu() { }) }, }) - // menuItems.push(downloadMenuItem) + menuItems.push(downloadMenuItem) } const allowsAdditional = + !persistedStoreState.disabledActions?.includes('tray-sync') || !persistedStoreState.disabledActions?.includes('tray-move') || !persistedStoreState.disabledActions?.includes('tray-serve') || !persistedStoreState.disabledActions?.includes('tray-purge') || @@ -539,6 +525,20 @@ export async function buildMenu() { if (allowsAdditional) { const commandsSubmenuItems: (MenuItem | Submenu | PredefinedMenuItem)[] = [] + if (!persistedStoreState.disabledActions?.includes('tray-sync')) { + const syncMenuItem = await MenuItem.new({ + id: 'sync', + text: 'Sync', + action: async () => { + await openWindow({ + name: 'Sync', + url: '/sync', + }) + }, + }) + commandsSubmenuItems.push(syncMenuItem) + } + if (!persistedStoreState.disabledActions?.includes('tray-move')) { const moveMenuItem = await MenuItem.new({ id: 'move',