增加隐式调试模式;修复mac下环境变量不正确的bug
parent
41088d5247
commit
8e1decd7e0
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "sonist",
|
||||
"version": "0.9.1",
|
||||
"version": "0.9.2",
|
||||
"description": "Music Player",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -28,7 +28,11 @@
|
|||
<div class="holder"></div>
|
||||
<div class="tools do-fn-drag">
|
||||
<div class="search do-fn-nodrag">
|
||||
<input class="do-ui-input" placeholder="搜索 音乐/歌手/专辑" value="">
|
||||
<input
|
||||
class="do-ui-input"
|
||||
placeholder="搜索 音乐/歌手/专辑"
|
||||
:keyup="searchMusic"
|
||||
:duplex="searchTxt">
|
||||
<i class="icon do-icon-search"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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
|
||||
|
|
23
src/main.js
23
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()
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
Reference in New Issue