Implement adaptive taskbar size
This commit is contained in:
parent
03bffeda8a
commit
2c08852c75
1 changed files with 8 additions and 4 deletions
|
@ -9,6 +9,9 @@ const els = require("electron-localshortcut");
|
||||||
const devTools = require("electron-devtools-installer");
|
const devTools = require("electron-devtools-installer");
|
||||||
const chalk = require("chalk");
|
const chalk = require("chalk");
|
||||||
|
|
||||||
|
const windowWidth = 1000;
|
||||||
|
const windowHeight = 350;
|
||||||
|
|
||||||
let tray = null;
|
let tray = null;
|
||||||
let mainWindow = null;
|
let mainWindow = null;
|
||||||
const gotTheLock = app.requestSingleInstanceLock();
|
const gotTheLock = app.requestSingleInstanceLock();
|
||||||
|
@ -31,10 +34,10 @@ const getAssetPath = (...paths) => path.join(RESOURCES_PATH, ...paths);
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
const win = new BrowserWindow({
|
const win = new BrowserWindow({
|
||||||
width: 620,
|
width: windowWidth,
|
||||||
height: 350,
|
height: windowHeight,
|
||||||
x: screenz.width - 620,
|
x: screenz.width - windowWidth,
|
||||||
y: screenz.height - 350 - 40,
|
y: screenz.height - windowHeight,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
enableRemoteModule: true,
|
enableRemoteModule: true,
|
||||||
|
@ -152,6 +155,7 @@ if (!gotTheLock) {
|
||||||
mainWindow.webContents.on("did-frame-finish-load", () => {
|
mainWindow.webContents.on("did-frame-finish-load", () => {
|
||||||
// Create tray icon with context menu
|
// Create tray icon with context menu
|
||||||
tray = createTray();
|
tray = createTray();
|
||||||
|
mainWindow.setBounds({ y: (screenz.height - mainWindow.getBounds().height) - tray.getBounds().height });
|
||||||
|
|
||||||
// Listen to tray icon onclick event
|
// Listen to tray icon onclick event
|
||||||
tray.on("click", () => {
|
tray.on("click", () => {
|
||||||
|
|
Reference in a new issue