From 8e1decd7e06e4b37429a546b5a5bcd6a03aad748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Sun, 20 Jan 2019 20:30:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=9A=90=E5=BC=8F=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E6=A8=A1=E5=BC=8F;=E4=BF=AE=E5=A4=8Dmac=E4=B8=8B?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E4=B8=8D=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/index.html | 6 +++++- src/js/app.js | 11 +++++++++++ src/main.js | 23 ++++++++++++++++++++++- 4 files changed, 39 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 24ce905..2801eb2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sonist", - "version": "0.9.1", + "version": "0.9.2", "description": "Music Player", "main": "src/main.js", "scripts": { diff --git a/src/index.html b/src/index.html index 5c92b00..0470dd9 100644 --- a/src/index.html +++ b/src/index.html @@ -28,7 +28,11 @@
diff --git a/src/js/app.js b/src/js/app.js index d59352f..3b44376 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -93,6 +93,7 @@ Anot({ theme: appInit.theme || 1, // 1:macos, 2: deepin winFocus: false, mod: 'local', + searchTxt: '', playMode: Anot.ls('play-mode') >>> 0, // 0:all | 1:single | 2:random ktvMode: 0, isPlaying: false, @@ -295,6 +296,16 @@ Anot({ Anot.ls('volume', volume) }, + searchMusic(ev) { + if (ev.keyCode === 13) { + if (this.searchTxt === ':debug:') { + log('----- 调试模式 -----') + this.searchTxt = '' + WIN.openDevTools() + } + } + }, + __draw__() { let play = this.isPlaying let rx = (play ? 112 : 40) + this.__HEIGHT__ / 2 // 旋转唱片的圆心坐标X diff --git a/src/main.js b/src/main.js index 192075d..707d3b2 100644 --- a/src/main.js +++ b/src/main.js @@ -11,6 +11,19 @@ const fs = require('iofs') const { exec } = require('child_process') const log = console.log +/* ******************************* */ +/* **********修复环境变量*********** */ +/* ******************************* */ +let PATH_SET = new Set() +process.env.PATH.split(':').forEach(_ => { + PATH_SET.add(_) +}) +PATH_SET.add('/usr/local/bin') +PATH_SET.add('/usr/local/sbin') + +process.env.PATH = Array.from(PATH_SET).join(':') +PATH_SET = null + const ROOT = __dirname const HOME = app.getPath('home') const MIME_TYPES = { @@ -81,7 +94,8 @@ function createWindow() { webPreferences: { webSecurity: false, experimentalFeatures: true - } + }, + show: false }) // 然后加载应用的 index.html。 @@ -131,6 +145,10 @@ app.once('ready', () => { ) createWindow() + + win.on('ready-to-show', _ => { + win.show() + }) // win.openDevTools() } else { win = new BrowserWindow({ @@ -144,6 +162,9 @@ app.once('ready', () => { }) win.setMenuBarVisibility(false) win.loadURL('app://sonist/depends.html') + win.on('closed', _ => { + app.exit() + }) } }) })