From b6163b4cac7159a38e47f23216900fdff9109960 Mon Sep 17 00:00:00 2001 From: 18alantom <2.alan.tom@gmail.com> Date: Thu, 21 Apr 2022 18:47:06 +0530 Subject: [PATCH] incr: remove 600x600 windows --- main.ts | 9 +++++---- main/helpers.ts | 14 -------------- main/registerIpcMainActionListeners.ts | 5 ----- main/registerIpcMainMessageListeners.ts | 7 ------- src/App.vue | 21 --------------------- src/renderer.ts | 2 +- utils/messages.ts | 2 -- 7 files changed, 6 insertions(+), 54 deletions(-) delete mode 100644 main/helpers.ts diff --git a/main.ts b/main.ts index 39ee7b9a..b6409afb 100644 --- a/main.ts +++ b/main.ts @@ -10,7 +10,6 @@ import Store from 'electron-store'; import { autoUpdater } from 'electron-updater'; import path from 'path'; import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'; -import { getMainWindowSize } from './main/helpers'; import registerAppLifecycleListeners from './main/registerAppLifecycleListeners'; import registerAutoUpdaterListeners from './main/registerAutoUpdaterListeners'; import registerIpcMainActionListeners from './main/registerIpcMainActionListeners'; @@ -18,6 +17,9 @@ import registerIpcMainMessageListeners from './main/registerIpcMainMessageListen import registerProcessListeners from './main/registerProcessListeners'; import { IPC_CHANNELS } from './utils/messages'; +const WIDTH = 1200; +const HEIGHT = 907; + export class Main { title: string = 'Frappe Books'; icon: string; @@ -69,13 +71,12 @@ export class Main { } getOptions(): BrowserWindowConstructorOptions { - const { width, height } = getMainWindowSize(); const options: BrowserWindowConstructorOptions = { vibrancy: 'sidebar', transparent: this.isMac, backgroundColor: '#80FFFFFF', - width, - height, + width: WIDTH, + height: HEIGHT, title: this.title, webPreferences: { contextIsolation: false, // TODO: Switch this off diff --git a/main/helpers.ts b/main/helpers.ts deleted file mode 100644 index 6bebddd2..00000000 --- a/main/helpers.ts +++ /dev/null @@ -1,14 +0,0 @@ -import electron, { app } from 'electron'; - -export function getMainWindowSize() { - let height; - if (app.isReady()) { - const screen = electron.screen; - height = screen.getPrimaryDisplay().workAreaSize.height; - height = height > 907 ? 907 : height; - } else { - height = 907; - } - const width = Math.ceil(1.323 * height); - return { height, width }; -} diff --git a/main/registerIpcMainActionListeners.ts b/main/registerIpcMainActionListeners.ts index 97da5eb1..0f6a46bc 100644 --- a/main/registerIpcMainActionListeners.ts +++ b/main/registerIpcMainActionListeners.ts @@ -10,7 +10,6 @@ import saveHtmlAsPdf from '../src/saveHtmlAsPdf'; import { DatabaseMethod } from '../utils/db/types'; import { DatabaseResponse } from '../utils/ipc/types'; import { IPC_ACTIONS } from '../utils/messages'; -import { getMainWindowSize } from './helpers'; export default function registerIpcMainActionListeners(main: Main) { ipcMain.handle(IPC_ACTIONS.TOGGLE_MAXIMIZE_CURRENT_WINDOW, (event) => { @@ -31,10 +30,6 @@ export default function registerIpcMainActionListeners(main: Main) { return await dialog.showSaveDialog(main.mainWindow!, options); }); - ipcMain.handle(IPC_ACTIONS.GET_PRIMARY_DISPLAY_SIZE, (event) => { - return getMainWindowSize(); - }); - ipcMain.handle(IPC_ACTIONS.GET_DIALOG_RESPONSE, async (event, options) => { if (main.isDevelopment || main.isLinux) { Object.assign(options, { icon: main.icon }); diff --git a/main/registerIpcMainMessageListeners.ts b/main/registerIpcMainMessageListeners.ts index aa5da057..30f2f32f 100644 --- a/main/registerIpcMainMessageListeners.ts +++ b/main/registerIpcMainMessageListeners.ts @@ -21,13 +21,6 @@ export default function registerIpcMainMessageListeners(main: Main) { main.mainWindow!.reload(); }); - ipcMain.on(IPC_MESSAGES.RESIZE_MAIN_WINDOW, (event, size, resizable) => { - const [width, height] = size; - if (!width || !height) return; - main.mainWindow!.setSize(width, height); - main.mainWindow!.setResizable(resizable); - }); - ipcMain.on(IPC_MESSAGES.CLOSE_CURRENT_WINDOW, (event) => { main.mainWindow!.close(); }); diff --git a/src/App.vue b/src/App.vue index 424e9198..7c2136cd 100644 --- a/src/App.vue +++ b/src/App.vue @@ -30,9 +30,7 @@