Skip to content

Commit

Permalink
feat: add cmd+q hotkey to close the app (macOS)
Browse files Browse the repository at this point in the history
this commit closes #181
  • Loading branch information
4gray committed Dec 21, 2022
1 parent 0107e35 commit f3e00e7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion electron/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-useless-catch */
import { app, BrowserWindow, Menu } from 'electron';
import { app, BrowserWindow, globalShortcut, Menu } from 'electron';
import * as path from 'path';
import * as url from 'url';
import { Api } from './api';
Expand Down Expand Up @@ -69,9 +69,21 @@ function createWindow(): BrowserWindow {
}
});

registerGlobalShortcuts();
return win;
}

/**
* Registers common keyboard shortcuts
*/
function registerGlobalShortcuts() {
if (process.platform === 'darwin') {
globalShortcut.register('Command+Q', () => {
app.quit();
});
}
}

/**
* Creates hidden window for EPG worker
* Hidden window is used as an additional thread to avoid blocking of the UI by long operations
Expand Down

0 comments on commit f3e00e7

Please sign in to comment.