feat(desktop-ui): Command/ctrl + comma goes to Settings view (#1439)

This commit is contained in:
Matthew Diamant
2025-02-28 12:35:10 -08:00
committed by GitHub
parent 633f628115
commit 36726cfb80
3 changed files with 23 additions and 1 deletions

View File

@@ -150,6 +150,12 @@ export default function App() {
};
}, []);
useEffect(() => {
const handleSetView = (_, view) => setView(view);
window.electron.on('set-view', handleSetView);
return () => window.electron.off('set-view', handleSetView);
}, []);
const handleConfirm = async () => {
if (pendingLink && !isInstalling) {
setIsInstalling(true);

View File

@@ -228,7 +228,7 @@ export default function MoreMenu({ setView }: { setView: (view: View) => void })
}}
className="w-full text-left p-2 text-sm hover:bg-bgSubtle transition-colors"
>
Settings
Settings (cmd+,)
</button>
<button

View File

@@ -473,6 +473,22 @@ app.whenReady().then(async () => {
// Get the existing menu
const menu = Menu.getApplicationMenu();
// App menu
const appMenu = menu.items.find((item) => item.label === 'Goose');
// add Settings to app menu after About
appMenu.submenu.insert(1, new MenuItem({ type: 'separator' }));
appMenu.submenu.insert(1,
new MenuItem({
label: 'Settings',
accelerator: 'CmdOrCtrl+,',
click() {
const focusedWindow = BrowserWindow.getFocusedWindow();
if (focusedWindow) focusedWindow.webContents.send('set-view', 'settings');
},
})
);
appMenu.submenu.insert(1, new MenuItem({ type: 'separator' }));
// Add Environment menu items to View menu
const viewMenu = menu.items.find((item) => item.label === 'View');
if (viewMenu) {