소스 검색

fixed app not quitting completely on cmd-q

Eugene Pankov 4 년 전
부모
커밋
bcf09c59e3
2개의 변경된 파일9개의 추가작업 그리고 7개의 파일을 삭제
  1. 9 1
      app/lib/app.ts
  2. 0 6
      app/lib/index.ts

+ 9 - 1
app/lib/app.ts

@@ -22,6 +22,7 @@ export class Application {
     private ptyManager = new PTYManager()
     private windows: Window[] = []
     private globalHotkey$ = new Subject<void>()
+    private quitRequested = false
     userPluginsPath: string
 
     constructor () {
@@ -82,6 +83,12 @@ export class Application {
         for (const flag of configData.flags || [['force_discrete_gpu', '0']]) {
             app.commandLine.appendSwitch(flag[0], flag[1])
         }
+
+        app.on('window-all-closed', () => {
+            if (this.quitRequested || process.platform !== 'darwin') {
+                app.quit()
+            }
+        })
     }
 
     init (): void {
@@ -226,7 +233,8 @@ export class Application {
                     {
                         label: 'Quit',
                         accelerator: 'Cmd+Q',
-                        click () {
+                        click: () => {
+                            this.quitRequested = true
                             app.quit()
                         },
                     },

+ 0 - 6
app/lib/index.ts

@@ -26,12 +26,6 @@ app.on('activate', () => {
     }
 })
 
-app.on('window-all-closed', () => {
-    if (process.platform !== 'darwin') {
-        app.quit()
-    }
-})
-
 process.on('uncaughtException' as any, err => {
     console.log(err)
     application.broadcast('uncaughtException', err)