feat(electron): add dblclick maximize for mac

This commit is contained in:
Dean Campbell
2020-10-08 18:08:53 -07:00
parent 2277ba1a72
commit bcc382fbcc
2 changed files with 18 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
<div class="titlebar bg-purple-1 text-light" [ngClass]="{'titlebar-mac': isMac, 'titlebar-windows': isWindows }">
<div class="titlebar-drag-region"></div>
<div class="titlebar-drag-region" (dblclick)="onDblClick()"></div>
<div class="window-logo-container" *ngIf="electronService.isWin">
<img src="assets/wowup_logo_512np.png" />
</div>

View File

@@ -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();
}
}
}
}