Skip to content

Commit

Permalink
Fullscreen shortcut bug (Resolve #18)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosrg9 committed Apr 14, 2022
1 parent 6c182db commit f834598
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "youtube-tv-electron",
"productName": "YouTube TV",
"version": "2.2.3",
"version": "2.2.4",
"description": "Cliente de YouTube TV sencillo para escritorio basado en electron.",
"main": "main.js",
"dependencies": {
Expand Down
24 changes: 9 additions & 15 deletions renderer/main_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,16 @@ class Renderer {
try {
const { width, height } = JSON.parse(a);
this.setResEmulator(width, height);
console.log('Estableciendo resolución preferida');
} catch (error) {
this.setResEmulator(3840,2160);
}
}
})
.catch((err) => {
console.log(err)
this.setResEmulator(3840,2160);
})

ipcMain.on('network', (_, status) => {
if (typeof status == 'boolean') {
console.log('Estado de primer inicio');
console.log(status);
} else {
console.log('Cambio de estado de red!');
console.log(status);
}
})
//ipcMain.on('network', (_, status) => { })

this.loadURL();

Expand All @@ -72,6 +62,7 @@ class Renderer {
this.settings = new Settings();
}
})

globalShortcut.register('ctrl+f', () => {
this.toggleFullScreen();
})
Expand Down Expand Up @@ -148,11 +139,13 @@ class Renderer {
`)
}

/**
* Conmuta entre estados de pantalla completa.
* @param {boolean} forced Fuerza un estado concreto.
*/
toggleFullScreen(forced) {
if (forced == undefined) {
if (this.window.fullScreen) {
this.window.setFullScreen(false)
}
if (!forced || typeof forced !== 'boolean') {
this.window.setFullScreen(!this.window.fullScreen);
} else {
this.window.setFullScreen(forced);
}
Expand All @@ -174,6 +167,7 @@ class Renderer {
!a ? this.window.loadURL(this.url, {userAgent: this.userAgent})
: this.window.loadURL(this.url+a, {userAgent: this.userAgent});
} catch (error) {
debugger;
console.error(error);
}
}
Expand Down

0 comments on commit f834598

Please sign in to comment.