Skip to content

Commit

Permalink
Picture in Picture and background color fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Lleyton committed Dec 16, 2021
1 parent cda6f68 commit 01b2bf2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "skye",
"version": "6.3.2",
"version": "6.4.0",
"sideEffects": false,
"description": "Extensible, fast and innovative web browser with Innatical UI.",
"keywords": [
Expand Down
20 changes: 20 additions & 0 deletions src/main/menus/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,26 @@ export const getViewMenu = (
]);
}

if (params.mediaFlags.canShowPictureInPicture) {
menuItems = menuItems.concat([
{
type: 'checkbox',
label: 'Picture in Picture',
checked: params.mediaFlags.isShowingPictureInPicture,
click: () => {
webContents.executeJavaScript(
params.mediaFlags.isShowingPictureInPicture
? `document.exitPictureInPicture()`
: `document.elementFromPoint(${params.x}, ${params.y}).requestPictureInPicture()`,
);
},
},
{
type: 'separator',
},
]);
}

if (params.isEditable) {
menuItems = menuItems.concat([
{
Expand Down
4 changes: 4 additions & 0 deletions src/main/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export class View {
'did-navigate-in-page',
async (e, url, isMainFrame) => {
if (isMainFrame) {
this.browserView.setBackgroundColor('#FFFFFFFF');
this.window.updateTitle();
await this.updateData();

Expand All @@ -159,19 +160,22 @@ export class View {
);

this.webContents.addListener('did-stop-loading', async () => {
this.browserView.setBackgroundColor('#FFFFFFFF');
this.updateNavigationState();
this.emitEvent('loading', false);
await this.updateURL(this.webContents.getURL());
});

this.webContents.addListener('did-start-loading', async () => {
this.browserView.setBackgroundColor('#FFFFFFFF');
this.hasError = false;
this.updateNavigationState();
this.emitEvent('loading', true);
await this.updateURL(this.webContents.getURL());
});

this.webContents.addListener('did-start-navigation', async (e, ...args) => {
this.browserView.setBackgroundColor('#FFFFFFFF');
this.updateNavigationState();

this.favicon = '';
Expand Down

0 comments on commit 01b2bf2

Please sign in to comment.