feat(desktop-ui): Command/ctrl + comma goes to Settings view (#1439)
This commit is contained in:
@@ -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 () => {
|
const handleConfirm = async () => {
|
||||||
if (pendingLink && !isInstalling) {
|
if (pendingLink && !isInstalling) {
|
||||||
setIsInstalling(true);
|
setIsInstalling(true);
|
||||||
|
|||||||
@@ -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"
|
className="w-full text-left p-2 text-sm hover:bg-bgSubtle transition-colors"
|
||||||
>
|
>
|
||||||
Settings
|
Settings (cmd+,)
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -473,6 +473,22 @@ app.whenReady().then(async () => {
|
|||||||
// Get the existing menu
|
// Get the existing menu
|
||||||
const menu = Menu.getApplicationMenu();
|
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
|
// Add Environment menu items to View menu
|
||||||
const viewMenu = menu.items.find((item) => item.label === 'View');
|
const viewMenu = menu.items.find((item) => item.label === 'View');
|
||||||
if (viewMenu) {
|
if (viewMenu) {
|
||||||
|
|||||||
Reference in New Issue
Block a user