Merge pull request #118 from mrchops1024/feat/mac-dblclick-maximize

feat(electron): add dblclick maximize for mac
This commit is contained in:
jliddev
2020-10-14 01:18:03 -05:00
committed by GitHub
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

@@ -52,4 +52,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();
}
}
}
}