From c5dcf47601280282be018a5d5d9e4494486dc9c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Thu, 31 Jan 2019 21:29:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E6=A1=8C=E9=9D=A2=E6=AD=8C=E8=AF=8D?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E6=94=BE=E5=88=B0=E6=B8=B2=E6=9F=93=E8=BF=9B?= =?UTF-8?q?=E7=A8=8B=E4=B8=AD=E5=88=9B=E5=BB=BA,=E4=BB=A5=E8=A7=A3?= =?UTF-8?q?=E5=86=B3linux=E4=B8=8B=E6=89=93=E5=8C=85=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E5=A5=87=E8=91=A9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js/app.js | 9 +++++++-- src/main.js | 13 ++----------- src/tools/windows.js | 5 ++++- 3 files changed, 13 insertions(+), 14 deletions(-) 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 })