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() + }) } }) })