mirror of
https://github.com/aljazceru/goose.git
synced 2026-02-19 13:34:22 +01:00
feat: menu to check Goose Desktop's version on Linux (#2450)
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
"license": {
|
||||
"name": "Apache-2.0"
|
||||
},
|
||||
"version": "1.0.21"
|
||||
"version": "1.0.22"
|
||||
},
|
||||
"paths": {
|
||||
"/agent/tools": {
|
||||
|
||||
@@ -928,6 +928,48 @@ app.whenReady().then(async () => {
|
||||
);
|
||||
}
|
||||
|
||||
// on macOS, the topbar is hidden
|
||||
if (menu && process.platform !== 'darwin') {
|
||||
let helpMenu = menu.items.find((item) => item.label === 'Help');
|
||||
|
||||
// If Help menu doesn't exist, create it and add it to the menu
|
||||
if (!helpMenu) {
|
||||
helpMenu = new MenuItem({
|
||||
label: 'Help',
|
||||
submenu: Menu.buildFromTemplate([]), // Start with an empty submenu
|
||||
});
|
||||
// Find a reasonable place to insert the Help menu, usually near the end
|
||||
const insertIndex = menu.items.length > 0 ? menu.items.length - 1 : 0;
|
||||
menu.items.splice(insertIndex, 0, helpMenu);
|
||||
}
|
||||
|
||||
// Ensure the Help menu has a submenu before appending
|
||||
if (helpMenu.submenu) {
|
||||
// Add a separator before the About item if the submenu is not empty
|
||||
if (helpMenu.submenu.items.length > 0) {
|
||||
helpMenu.submenu.append(new MenuItem({ type: 'separator' }));
|
||||
}
|
||||
|
||||
// Create the About Goose menu item with a submenu
|
||||
const aboutGooseMenuItem = new MenuItem({
|
||||
label: 'About Goose',
|
||||
submenu: Menu.buildFromTemplate([]), // Start with an empty submenu for About
|
||||
});
|
||||
|
||||
// Add the Version menu item (display only) to the About Goose submenu
|
||||
if (aboutGooseMenuItem.submenu) {
|
||||
aboutGooseMenuItem.submenu.append(
|
||||
new MenuItem({
|
||||
label: `Version ${gooseVersion || app.getVersion()}`,
|
||||
enabled: false,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
helpMenu.submenu.append(aboutGooseMenuItem);
|
||||
}
|
||||
}
|
||||
|
||||
if (menu) {
|
||||
Menu.setApplicationMenu(menu);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user