diff --git a/apps/desktop-timer/src/preload.ts b/apps/desktop-timer/src/preload.ts index fd1459c8709..d918b204482 100644 --- a/apps/desktop-timer/src/preload.ts +++ b/apps/desktop-timer/src/preload.ts @@ -17,6 +17,10 @@ window.addEventListener('DOMContentLoaded', async () => { titleBar.refreshMenu(); }); + ipcRenderer.on('hide-menu', () => { + titleBar.dispose(); + }) + const overStyle = document.createElement('style'); overStyle.innerHTML = ` .cet-container { diff --git a/apps/desktop/src/preload/preload.ts b/apps/desktop/src/preload/preload.ts index dbcec63fd7b..96f890c7c53 100644 --- a/apps/desktop/src/preload/preload.ts +++ b/apps/desktop/src/preload/preload.ts @@ -21,6 +21,10 @@ window.addEventListener('DOMContentLoaded', async () => { titleBar.refreshMenu(); }); + ipcRenderer.on('hide-menu', () => { + titleBar.dispose(); + }) + ipcRenderer.on('adjust_view', () => { clearInterval(contentInterval); const headerIcon = '/html/body/div[2]/ga-app/ngx-pages/ngx-one-column-layout/nb-layout/div[1]/div/div/nb-sidebar[1]/div/div/div'; diff --git a/apps/server-api/src/preload/preload.ts b/apps/server-api/src/preload/preload.ts index c9b66089034..b5ba9a2fc97 100644 --- a/apps/server-api/src/preload/preload.ts +++ b/apps/server-api/src/preload/preload.ts @@ -17,6 +17,10 @@ window.addEventListener('DOMContentLoaded', async () => { titleBar.refreshMenu(); }); + ipcRenderer.on('hide-menu', () => { + titleBar.dispose(); + }) + const overStyle = document.createElement('style'); overStyle.innerHTML = ` .cet-menubar-menu-container { diff --git a/apps/server/src/preload/preload.ts b/apps/server/src/preload/preload.ts index c9b66089034..b5ba9a2fc97 100644 --- a/apps/server/src/preload/preload.ts +++ b/apps/server/src/preload/preload.ts @@ -17,6 +17,10 @@ window.addEventListener('DOMContentLoaded', async () => { titleBar.refreshMenu(); }); + ipcRenderer.on('hide-menu', () => { + titleBar.dispose(); + }) + const overStyle = document.createElement('style'); overStyle.innerHTML = ` .cet-menubar-menu-container { diff --git a/packages/desktop-libs/src/lib/desktop-menu.ts b/packages/desktop-libs/src/lib/desktop-menu.ts index 68ccf3658b3..a439701eed0 100644 --- a/packages/desktop-libs/src/lib/desktop-menu.ts +++ b/packages/desktop-libs/src/lib/desktop-menu.ts @@ -23,7 +23,7 @@ export class AppMenu { label: TranslateService.instant('MENU.ABOUT'), enabled: true, async click() { - const window: BrowserWindow = await createAboutWindow(windowPath.timeTrackerUi); + const window: BrowserWindow = await createAboutWindow(windowPath.timeTrackerUi, windowPath.preloadPath); window.show(); } }, diff --git a/packages/desktop-ui-lib/src/lib/dialogs/about/about.component.html b/packages/desktop-ui-lib/src/lib/dialogs/about/about.component.html index 6314cb813f9..9f932d38438 100644 --- a/packages/desktop-ui-lib/src/lib/dialogs/about/about.component.html +++ b/packages/desktop-ui-lib/src/lib/dialogs/about/about.component.html @@ -19,11 +19,13 @@ Copyright © 2020-{{'FOOTER.PRESENT' | translate}} {{ application?.companyName}} -
+
{{'FOOTER.RIGHTS_RESERVED' | translate}} -
- {{'FOOTER.TERMS_OF_SERVICE' | translate}} | - {{'FOOTER.PRIVACY_POLICY' | translate}} +
+ {{'FOOTER.TERMS_OF_SERVICE' | + translate}} | + {{'FOOTER.PRIVACY_POLICY' | + translate}}
diff --git a/packages/desktop-ui-lib/src/lib/dialogs/about/about.component.scss b/packages/desktop-ui-lib/src/lib/dialogs/about/about.component.scss index 020389953df..cc210301002 100644 --- a/packages/desktop-ui-lib/src/lib/dialogs/about/about.component.scss +++ b/packages/desktop-ui-lib/src/lib/dialogs/about/about.component.scss @@ -46,4 +46,4 @@ div.logo { ::ng-deep nb-layout .layout .layout-container .content nb-layout-footer nav { padding: 0px; - } \ No newline at end of file +} diff --git a/packages/desktop-window/src/lib/desktop-window-about.ts b/packages/desktop-window/src/lib/desktop-window-about.ts index 65b61879bcb..6f4a61a9631 100644 --- a/packages/desktop-window/src/lib/desktop-window-about.ts +++ b/packages/desktop-window/src/lib/desktop-window-about.ts @@ -1,7 +1,6 @@ import * as remoteMain from '@electron/remote/main'; import { BrowserWindow, Menu } from 'electron'; import * as url from 'url'; -import { attachTitlebarToWindow } from 'custom-electron-titlebar/main'; import log from 'electron-log'; import { WindowManager } from './concretes/window.manager'; @@ -16,6 +15,13 @@ export async function createAboutWindow(filePath, preloadPath?) { const mainWindowSettings: Electron.BrowserWindowConstructorOptions = windowSetting(preloadPath); const manager = WindowManager.getInstance(); + const allwindows = BrowserWindow.getAllWindows(); + const aboutWindows = allwindows.find((win) => win.getTitle() === 'About'); + if (aboutWindows) { + aboutWindows.show(); + return aboutWindows; + } + const window = new BrowserWindow(mainWindowSettings); remoteMain.enable(window.webContents); const launchPath = url.format({ @@ -42,7 +48,7 @@ export async function createAboutWindow(filePath, preloadPath?) { manager.register(RegisteredWindow.ABOUT, window); if (preloadPath) { - attachTitlebarToWindow(window); + window.webContents.send('hide-menu'); } return window; } @@ -69,11 +75,6 @@ const windowSetting = (preloadPath) => { }; if (preloadPath) { mainWindowSettings.webPreferences.preload = preloadPath; - mainWindowSettings.titleBarOverlay = true; - mainWindowSettings.titleBarStyle = 'hidden'; - if (process.platform === 'linux') { - mainWindowSettings.frame = false; - } } return mainWindowSettings; }; diff --git a/packages/desktop-window/src/lib/desktop-window-timer.ts b/packages/desktop-window/src/lib/desktop-window-timer.ts index 35eb87ad7b7..53baaf5c2b5 100644 --- a/packages/desktop-window/src/lib/desktop-window-timer.ts +++ b/packages/desktop-window/src/lib/desktop-window-timer.ts @@ -12,6 +12,13 @@ Object.assign(console, log.functions); const Store = require('electron-store'); const store = new Store(); +function getScreenSize() { + const sizes = screen.getPrimaryDisplay().workAreaSize; + const width = sizes.height < 768 ? 310 : 360; + const height = sizes.height < 768 ? sizes.height - 20 : 768; + return { width, height } +} + export async function createTimeTrackerWindow(timeTrackerWindow, filePath, preloadPath?) { const mainWindowSettings: Electron.BrowserWindowConstructorOptions = windowSetting(preloadPath); const manager = WindowManager.getInstance(); @@ -29,6 +36,11 @@ export async function createTimeTrackerWindow(timeTrackerWindow, filePath, prelo timeTrackerWindow.hide(); await timeTrackerWindow.loadURL(launchPath); + if (preloadPath) { + attachTitlebarToWindow(timeTrackerWindow); + } + const { width, height } = getScreenSize(); + timeTrackerWindow.setMinimumSize(width, height); timeTrackerWindow.setMenu(null); timeTrackerWindow.on('close', (event) => { event.preventDefault(); @@ -36,17 +48,14 @@ export async function createTimeTrackerWindow(timeTrackerWindow, filePath, prelo }); manager.register(RegisteredWindow.TIMER, timeTrackerWindow); - if (preloadPath) { - attachTitlebarToWindow(timeTrackerWindow); - } + return timeTrackerWindow; } const windowSetting = (preloadPath?) => { const sizes = screen.getPrimaryDisplay().workAreaSize; - const height = sizes.height < 768 ? sizes.height - 20 : 768; + const { width, height } = getScreenSize(); const zoomF = sizes.height < 768 ? 0.8 : 1.0; - const width = sizes.height < 768 ? 310 : 360; const filesPath = store.get('filePath'); console.log('file path == ', filesPath); const mainWindowSettings: Electron.BrowserWindowConstructorOptions = {