diff --git a/src/js/app.js b/src/js/app.js index 75cedc2..4333f12 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -25,10 +25,15 @@ const log = console.log const fs = require('iofs') const path = require('path') -const { remote, ipcRenderer } = require('electron') +const { remote, ipcRenderer, screen } = require('electron') +const { createDesktopLrcWindow, createMiniWindow } = remote.require( + './tools/windows' +) +const MAIN_SCREEN = screen.getPrimaryDisplay() const WIN = remote.getCurrentWindow() -const { __LRC__, __MINI__ } = remote.app +const __LRC__ = createDesktopLrcWindow(MAIN_SCREEN) +const __MINI__ = createMiniWindow(MAIN_SCREEN) const PLAY_MODE = { 0: 'all', diff --git a/src/main.js b/src/main.js index 2b74124..e615223 100644 --- a/src/main.js +++ b/src/main.js @@ -6,8 +6,7 @@ 'use strict' -const electron = require('electron') -const { app, BrowserWindow, session, protocol } = electron +const { app, BrowserWindow, session, protocol } = require('electron') const path = require('path') const fs = require('iofs') const { exec } = require('child_process') @@ -27,12 +26,7 @@ const MIME_TYPES = { require('./tools/init') const createTray = require('./tools/tray') const createMenu = require('./tools/menu') -const { - createMainWindow, - createErrorWindow, - createDesktopLrcWindow, - createMiniWindow -} = require('./tools/windows') +const { createMainWindow, createErrorWindow } = require('./tools/windows') const ROOT = __dirname @@ -61,15 +55,12 @@ app.once('ready', () => { // 判断依赖 exec('which ffprobe', (err, res) => { if (res) { - let sp = electron.screen.getPrimaryDisplay() let win = createMainWindow(path.resolve(ROOT, './images/app.png')) createTray(win) createMenu(win) app.__MAIN__ = win - app.__LRC__ = createDesktopLrcWindow(sp) - app.__MINI__ = createMiniWindow(sp) // mac专属事件,点击dock栏图标,可激活窗口 app.on('activate', _ => { diff --git a/src/tools/windows.js b/src/tools/windows.js index a4e75a9..bac8561 100644 --- a/src/tools/windows.js +++ b/src/tools/windows.js @@ -33,7 +33,7 @@ exports.createMainWindow = function(icon) { win.on('ready-to-show', _ => { win.show() - // win.openDevTools() + win.openDevTools() }) return win @@ -77,6 +77,8 @@ exports.createDesktopLrcWindow = function(screen) { x: (screen.size.width - 1024) / 2, y: screen.size.height - 100, transparent: true, + hasShadow: false, + thickFrame: false, show: false }) @@ -98,6 +100,7 @@ exports.createMiniWindow = function(screen) { skipTaskbar: true, x: screen.size.width - 320, y: 0, + thickFrame: false, show: false })