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

绑定全局快捷键

2.x 1.1.0
宇天 2019-02-24 02:57:47 +08:00
parent 52cd2d9d49
commit a886037773
3 changed files with 51 additions and 3 deletions

View File

@ -217,7 +217,6 @@ Anot({
* 响应 全局快捷键的事件
*/
WIN.on('gs-ctrl', ev => {
log('gs-ctrl: ', ev)
switch (ev) {
case 'prev':
this.nextSong(-1)
@ -236,6 +235,26 @@ Anot({
SONIST.pause()
this.draw()
break
case 'vu':
this.volume += 5
if (this.volume >= 100) {
this.volume = 100
}
SONIST.volume = this.volume
break
case 'vd':
this.volume -= 5
if (this.volume <= 0) {
this.volume = 0
}
SONIST.volume = this.volume
break
case 'lrc':
this.toggleDesktopLrc()
break
case 'mini':
this.change2mini()
break
default:
break
}
@ -280,7 +299,6 @@ Anot({
this.volume = 0
}
SONIST.volume = this.volume
break
}
break
case 77: // M (迷你模式)

View File

@ -23,5 +23,35 @@ module.exports = {
GS.register('MediaPlayPause', _ => {
win.emit('gs-ctrl', 'play')
})
// others
GS.register('Super+Alt+Space', _ => {
win.emit('gs-ctrl', 'play')
})
GS.register('Super+Alt+Left', _ => {
win.emit('gs-ctrl', 'prev')
})
GS.register('Super+Alt+Right', _ => {
win.emit('gs-ctrl', 'next')
})
GS.register('Super+Alt+Up', _ => {
win.emit('gs-ctrl', 'vu')
})
GS.register('Super+Alt+Down', _ => {
win.emit('gs-ctrl', 'vd')
})
GS.register('Super+Alt+R', _ => {
win.emit('gs-ctrl', 'lrc')
})
GS.register('Super+Alt+Shift+M', _ => {
win.emit('gs-ctrl', 'mini')
})
}
}

View File

@ -33,7 +33,7 @@ exports.createMainWindow = function(icon) {
win.on('ready-to-show', _ => {
win.show()
win.openDevTools()
// win.openDevTools()
})
return win