This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
appcat
/
sonist
Archived
1
0
Fork 0

增加隐式调试模式;修复mac下环境变量不正确的bug

2.x
宇天 2019-01-20 20:30:09 +08:00
parent 41088d5247
commit 8e1decd7e0
4 changed files with 39 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "sonist", "name": "sonist",
"version": "0.9.1", "version": "0.9.2",
"description": "Music Player", "description": "Music Player",
"main": "src/main.js", "main": "src/main.js",
"scripts": { "scripts": {

View File

@ -28,7 +28,11 @@
<div class="holder"></div> <div class="holder"></div>
<div class="tools do-fn-drag"> <div class="tools do-fn-drag">
<div class="search do-fn-nodrag"> <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> <i class="icon do-icon-search"></i>
</div> </div>
</div> </div>

View File

@ -93,6 +93,7 @@ Anot({
theme: appInit.theme || 1, // 1:macos, 2: deepin theme: appInit.theme || 1, // 1:macos, 2: deepin
winFocus: false, winFocus: false,
mod: 'local', mod: 'local',
searchTxt: '',
playMode: Anot.ls('play-mode') >>> 0, // 0:all | 1:single | 2:random playMode: Anot.ls('play-mode') >>> 0, // 0:all | 1:single | 2:random
ktvMode: 0, ktvMode: 0,
isPlaying: false, isPlaying: false,
@ -295,6 +296,16 @@ Anot({
Anot.ls('volume', volume) Anot.ls('volume', volume)
}, },
searchMusic(ev) {
if (ev.keyCode === 13) {
if (this.searchTxt === ':debug:') {
log('----- 调试模式 -----')
this.searchTxt = ''
WIN.openDevTools()
}
}
},
__draw__() { __draw__() {
let play = this.isPlaying let play = this.isPlaying
let rx = (play ? 112 : 40) + this.__HEIGHT__ / 2 // 旋转唱片的圆心坐标X let rx = (play ? 112 : 40) + this.__HEIGHT__ / 2 // 旋转唱片的圆心坐标X

View File

@ -11,6 +11,19 @@ const fs = require('iofs')
const { exec } = require('child_process') const { exec } = require('child_process')
const log = console.log 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 ROOT = __dirname
const HOME = app.getPath('home') const HOME = app.getPath('home')
const MIME_TYPES = { const MIME_TYPES = {
@ -81,7 +94,8 @@ function createWindow() {
webPreferences: { webPreferences: {
webSecurity: false, webSecurity: false,
experimentalFeatures: true experimentalFeatures: true
} },
show: false
}) })
// 然后加载应用的 index.html。 // 然后加载应用的 index.html。
@ -131,6 +145,10 @@ app.once('ready', () => {
) )
createWindow() createWindow()
win.on('ready-to-show', _ => {
win.show()
})
// win.openDevTools() // win.openDevTools()
} else { } else {
win = new BrowserWindow({ win = new BrowserWindow({
@ -144,6 +162,9 @@ app.once('ready', () => {
}) })
win.setMenuBarVisibility(false) win.setMenuBarVisibility(false)
win.loadURL('app://sonist/depends.html') win.loadURL('app://sonist/depends.html')
win.on('closed', _ => {
app.exit()
})
} }
}) })
}) })