diff --git a/app/main/index.js b/app/main/index.js index 73a280d9..c97671f6 100644 --- a/app/main/index.js +++ b/app/main/index.js @@ -107,6 +107,14 @@ function createMainWindow() { conf.set('maximize', true); }); + win.on('enter-full-screen', () => { + win.webContents.send('enter-fullscreen'); + }); + + win.on('leave-full-screen', () => { + win.webContents.send('leave-fullscreen'); + }); + win.on('unmaximize', () => { conf.set('maximize', false); }); diff --git a/app/renderer/css/main.css b/app/renderer/css/main.css index a8b94827..e63b52bb 100644 --- a/app/renderer/css/main.css +++ b/app/renderer/css/main.css @@ -279,4 +279,38 @@ webview:focus { .hidden { display: none !important; -} \ No newline at end of file +} + +/* Full screen Popup container */ +.popup .popuptext { + visibility: hidden; + background-color: #555; + color: #fff; + text-align: center; + border-radius: 6px; + padding: 10px 0; + position: absolute; + z-index: 1; + width: 16%; + top: 15px; + height: 20px; + left: 43%; +} + +.popup .show { + visibility: visible; + animation: cssAnimation 0s ease-in 5s forwards; + animation-fill-mode: forwards; +} + +@keyframes cssAnimation { + from { + opacity: 0; + } + to { + width: 0; + height: 0; + overflow: hidden; + opacity: 1; + } +} diff --git a/app/renderer/js/main.js b/app/renderer/js/main.js index ef15c3b1..df81c677 100644 --- a/app/renderer/js/main.js +++ b/app/renderer/js/main.js @@ -23,6 +23,10 @@ class ServerManagerView { this.$settingsTooltip = $actionsContainer.querySelector('#setting-tooltip'); this.$sidebar = document.getElementById('sidebar'); + this.$fullscreenPopup = document.getElementById('fullscreen-popup'); + this.$fullscreenEscapeKey = process.platform === 'darwin' ? '^⌘F' : 'F11'; + this.$fullscreenPopup.innerHTML = `Press ${this.$fullscreenEscapeKey} to exit full screen`; + this.activeTabIndex = -1; this.tabs = []; this.functionalTabs = {}; @@ -255,17 +259,32 @@ class ServerManagerView { ipcRenderer.on('open-settings', (event, settingNav) => { this.openSettings(settingNav); }); + ipcRenderer.on('open-about', this.openAbout.bind(this)); + ipcRenderer.on('reload-viewer', this.reloadView.bind(this)); + ipcRenderer.on('hard-reload', () => { ipcRenderer.send('reload-full-app'); }); + ipcRenderer.on('switch-server-tab', (event, index) => { this.activateTab(index); }); + ipcRenderer.on('toggle-sidebar', (event, show) => { this.toggleSidebar(show); }); + + ipcRenderer.on('enter-fullscreen', () => { + this.$fullscreenPopup.classList.add('show'); + this.$fullscreenPopup.classList.remove('hidden'); + }); + + ipcRenderer.on('leave-fullscreen', () => { + this.$fullscreenPopup.classList.remove('show'); + }); + ipcRenderer.on('render-taskbar-icon', (event, messageCount) => { // Create a canvas from unread messagecounts function createOverlayIcon(messageCount) { diff --git a/app/renderer/main.html b/app/renderer/main.html index 825a7173..1d44993c 100644 --- a/app/renderer/main.html +++ b/app/renderer/main.html @@ -1,37 +1,43 @@ - - - - Zulip - - - -
-