mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-16 06:06:18 -08:00
feat: add cmd+q hotkey to close the app (macOS)
this commit closes #181
This commit is contained in:
1 parent
0107e351ab
commit
f3e00e78aa
1 file changed
+13
-1
+13
-1
@@ -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';
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user