Skip to content

Commit

Permalink
Merge pull request #1016 from MathewtheCoder/altair-1006-settings-dia…
Browse files Browse the repository at this point in the history
…log-keybinding

Added keyboard shortcut for displaying settings dialog.
  • Loading branch information
imolorhe committed Oct 18, 2019
2 parents 3720d81 + 58077c3 commit 98975a8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions packages/altair-electron/src/menu.js
Expand Up @@ -51,6 +51,11 @@ const createMenu = (actions) => {
submenu: [
{ role: "about" },
{ label: 'Check for Updates...', click: actions.checkForUpdates },
{
label: 'Preferences',
accelerator: 'Cmd+,',
click: actions.showSettings
},
{ type: "separator" },
{ role: "services", submenu: [] },
{ type: "separator" },
Expand Down
5 changes: 4 additions & 1 deletion packages/altair-electron/src/window.js
Expand Up @@ -38,6 +38,9 @@ const actions = {
showDocs: () => {
instance.webContents.send('show-docs', true);
},
showSettings: () => {
instance.webContents.send('show-settings', true);
},
checkForUpdates,
};

Expand Down Expand Up @@ -153,7 +156,7 @@ const createWindow = () => {
contents.on('new-window', (event, navigationUrl) => {
// Ask the operating system to open this event's url in the default browser.
event.preventDefault();

shell.openExternalSync(navigationUrl);
})
});
Expand Down
5 changes: 4 additions & 1 deletion src/app/services/electron-app/electron-app.service.ts
Expand Up @@ -11,6 +11,7 @@ import * as fromRoot from '../../reducers';

import * as queryActions from '../../actions/query/query';
import * as docsActions from '../../actions/docs/docs';
import * as windowsMetaActions from '../../actions/windows-meta/windows-meta';
import { debug } from 'app/utils/logger';

@Injectable()
Expand Down Expand Up @@ -69,7 +70,9 @@ export class ElectronAppService {
this.ipc.on('show-docs', () => {
this.zone.run(() => this.store.dispatch(new docsActions.ToggleDocsViewAction(this.activeWindowId)));
});

this.ipc.on('show-settings', () => {
this.zone.run(() => this.store.dispatch(new windowsMetaActions.ShowSettingsDialogAction({ value: true })));
});
debug.log('Electron app connected.');

this.ipc.send('get-file-opened');
Expand Down

0 comments on commit 98975a8

Please sign in to comment.