From bcc382fbcc05cbcbc670475806de0f5818c32aa7 Mon Sep 17 00:00:00 2001 From: Dean Campbell Date: Thu, 8 Oct 2020 18:08:53 -0700 Subject: [PATCH] feat(electron): add dblclick maximize for mac --- .../components/titlebar/titlebar.component.html | 2 +- .../components/titlebar/titlebar.component.ts | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/wowup-electron/src/app/components/titlebar/titlebar.component.html b/wowup-electron/src/app/components/titlebar/titlebar.component.html index d50386fb..56f58fb7 100644 --- a/wowup-electron/src/app/components/titlebar/titlebar.component.html +++ b/wowup-electron/src/app/components/titlebar/titlebar.component.html @@ -1,5 +1,5 @@
-
+
diff --git a/wowup-electron/src/app/components/titlebar/titlebar.component.ts b/wowup-electron/src/app/components/titlebar/titlebar.component.ts index 79734596..a242d0ba 100644 --- a/wowup-electron/src/app/components/titlebar/titlebar.component.ts +++ b/wowup-electron/src/app/components/titlebar/titlebar.component.ts @@ -51,4 +51,21 @@ export class TitlebarComponent implements OnInit, OnDestroy { onClickDebug() { this.electronService.remote.getCurrentWebContents().openDevTools(); } + + onDblClick() { + const win = this.electronService.remote.getCurrentWindow(); + + if (this.isMac) { + const action = this.electronService.remote.systemPreferences.getUserDefault('AppleActionOnDoubleClick', 'string'); + if (action === 'Maximize') { + if (win.isMaximized()) { + win.unmaximize(); + } else { + win.maximize(); + } + } else if (action === 'Minimize') { + win.minimize(); + } + } + } }