Skip to content

Commit 6cd5790

Browse files
committed
fix macOS window draggable area
1 parent 145a234 commit 6cd5790

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

src/models/ServiceBrowserView.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { sleep } from '../helpers/async-helpers';
1313
import { easeInOutSine } from '../helpers/animation-helpers';
1414
import { IPC } from '../features/todos/constants';
1515
import { getRecipeDirectory, loadRecipeConfig } from '../helpers/recipe-helpers';
16+
import { isMac } from '../environment';
1617

1718

1819
const debug = require('debug')('Franz:Models:ServiceBrowserView');
@@ -245,6 +246,7 @@ export class ServiceBrowserView {
245246
}
246247

247248
this.enableContextMenu();
249+
this.hacks();
248250

249251
this.webContents.loadURL(this.config.url);
250252
}
@@ -463,6 +465,24 @@ export class ServiceBrowserView {
463465
this.window.webContents.send(UPDATE_SERVICE_STATE, { serviceId: this.config.id, state: this.webContentsState });
464466
}
465467

468+
hacks() {
469+
this.webContents.insertCSS('html { background: white; } ');
470+
if (isMac) {
471+
this.webContents.insertCSS(`
472+
body:before {
473+
background: transparent;
474+
height: 30px;
475+
width: 100%;
476+
position: absolute;
477+
content: " ";
478+
z-index: 9999999;
479+
pointer-events: none;
480+
-webkit-app-region: drag;
481+
}
482+
`);
483+
}
484+
}
485+
466486
get webContents() {
467487
return this.view.webContents;
468488
}

src/webview/lib/RecipeWebview.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ class RecipeWebview {
1919
window.FranzAPI = {
2020
clearCache: RecipeWebview.clearCache,
2121
};
22-
23-
// fix BrowserView Background issue
24-
const styles = document.createElement('style');
25-
styles.innerHTML = 'html { background: white; }';
26-
27-
document.querySelector('head').appendChild(styles);
2822
}
2923

3024
loopFunc = () => null;

0 commit comments

Comments
 (0)