From 521c8d2d48499ae925d76760ce893de66c1efda9 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Wed, 24 Jun 2020 18:51:24 +0200 Subject: [PATCH] Hide navigation bar when window is in fullscreen --- frontend/sass/index.scss | 4 ++++ frontend/ts/index.ts | 7 ++++++- src/windows/MainWindow.ts | 7 +++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/frontend/sass/index.scss b/frontend/sass/index.scss index e576ef2..78e4807 100644 --- a/frontend/sass/index.scss +++ b/frontend/sass/index.scss @@ -12,6 +12,10 @@ body { flex-direction: column; height: 100%; width: var(--nav-width); + + body.fullscreen & { + display: none; + } } #navigation > :not(#service-buttons) { diff --git a/frontend/ts/index.ts b/frontend/ts/index.ts index 3164032..022e535 100644 --- a/frontend/ts/index.ts +++ b/frontend/ts/index.ts @@ -834,4 +834,9 @@ function setContextMenu(webContents: WebContents) { window: remote.getCurrentWindow(), }); }); -} \ No newline at end of file +} + +ipcRenderer.on('fullscreenchange', (e, fullscreen) => { + if (fullscreen) document.body.classList.add('fullscreen'); + else document.body.classList.remove('fullscreen'); +}); diff --git a/src/windows/MainWindow.ts b/src/windows/MainWindow.ts index 70ea2f7..7e91f82 100644 --- a/src/windows/MainWindow.ts +++ b/src/windows/MainWindow.ts @@ -129,6 +129,13 @@ export default class MainWindow extends Window { } }); + window.on('enter-full-screen', () => { + window.webContents.send('fullscreenchange', true); + }); + window.on('leave-full-screen', () => { + window.webContents.send('fullscreenchange', false); + }); + // Load navigation view window.loadFile(path.resolve(Meta.RESOURCES_PATH, 'index.html')) .catch(console.error);