优化逻辑
parent
69368b884f
commit
93bab6bbdd
|
@ -9,8 +9,6 @@ if (isMac) {
|
||||||
{ label: '关于洛雪音乐', role: 'about' },
|
{ label: '关于洛雪音乐', role: 'about' },
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{ label: '隐藏', role: 'hide' },
|
{ label: '隐藏', role: 'hide' },
|
||||||
{ label: '显示其他', role: 'hideothers' },
|
|
||||||
{ label: '显示全部', role: 'unhide' },
|
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{
|
{
|
||||||
label: '退出',
|
label: '退出',
|
||||||
|
@ -26,20 +24,20 @@ if (isMac) {
|
||||||
label: '窗口',
|
label: '窗口',
|
||||||
role: 'window',
|
role: 'window',
|
||||||
submenu: [
|
submenu: [
|
||||||
{ label: '最小化', role: 'minimize' },
|
{ label: '最小化', role: 'minimize', accelerator: 'Command+W' },
|
||||||
{ label: '关闭', role: 'close' },
|
{ label: '关闭', role: 'close' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '编辑',
|
label: '编辑',
|
||||||
submenu: [
|
submenu: [
|
||||||
{ label: '撤销', accelerator: 'CmdOrCtrl+Z', role: 'undo' },
|
{ label: '撤销', accelerator: 'Command+Z', role: 'undo' },
|
||||||
{ label: '恢复', accelerator: 'Shift+CmdOrCtrl+Z', role: 'redo' },
|
{ label: '恢复', accelerator: 'Shift+Command+Z', role: 'redo' },
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{ label: '剪切', accelerator: 'CmdOrCtrl+X', role: 'cut' },
|
{ label: '剪切', accelerator: 'Command+X', role: 'cut' },
|
||||||
{ label: '复制', accelerator: 'CmdOrCtrl+C', role: 'copy' },
|
{ label: '复制', accelerator: 'Command+C', role: 'copy' },
|
||||||
{ label: '粘贴', accelerator: 'CmdOrCtrl+V', role: 'paste' },
|
{ label: '粘贴', accelerator: 'Command+V', role: 'paste' },
|
||||||
{ label: '选择全部', accelerator: 'CmdOrCtrl+A', role: 'selectAll' },
|
{ label: '选择全部', accelerator: 'Command+A', role: 'selectAll' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -5,8 +5,26 @@ const { desktop_lyric } = require('../../../common/hotKey')
|
||||||
let isLock = null
|
let isLock = null
|
||||||
let isEnable = null
|
let isEnable = null
|
||||||
let isAlwaysOnTop = null
|
let isAlwaysOnTop = null
|
||||||
const setLrcConfig = isForceSet => {
|
const setLrcConfig = () => {
|
||||||
let desktopLyric = global.appSetting.desktopLyric
|
let desktopLyric = global.appSetting.desktopLyric
|
||||||
|
if (global.modules.lyricWindow) {
|
||||||
|
mainSend(global.modules.lyricWindow, ipcWinLyricNames.set_lyric_config, {
|
||||||
|
config: desktopLyric,
|
||||||
|
languageId: global.appSetting.langId,
|
||||||
|
})
|
||||||
|
if (isLock != desktopLyric.isLock) {
|
||||||
|
isLock = desktopLyric.isLock
|
||||||
|
if (desktopLyric.isLock) {
|
||||||
|
global.modules.lyricWindow.setIgnoreMouseEvents(true, { forward: false })
|
||||||
|
} else {
|
||||||
|
global.modules.lyricWindow.setIgnoreMouseEvents(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isAlwaysOnTop != desktopLyric.isAlwaysOnTop) {
|
||||||
|
isAlwaysOnTop = desktopLyric.isAlwaysOnTop
|
||||||
|
global.modules.lyricWindow.setAlwaysOnTop(desktopLyric.isAlwaysOnTop, 'screen-saver')
|
||||||
|
}
|
||||||
|
}
|
||||||
if (isEnable != desktopLyric.enable) {
|
if (isEnable != desktopLyric.enable) {
|
||||||
isEnable = desktopLyric.enable
|
isEnable = desktopLyric.enable
|
||||||
if (desktopLyric.enable) {
|
if (desktopLyric.enable) {
|
||||||
|
@ -15,30 +33,12 @@ const setLrcConfig = isForceSet => {
|
||||||
global.lx_event.winLyric.close()
|
global.lx_event.winLyric.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (global.modules.lyricWindow) {
|
|
||||||
mainSend(global.modules.lyricWindow, ipcWinLyricNames.set_lyric_config, {
|
|
||||||
config: desktopLyric,
|
|
||||||
languageId: global.appSetting.langId,
|
|
||||||
})
|
|
||||||
if (isForceSet || isLock != desktopLyric.isLock) {
|
|
||||||
isLock = desktopLyric.isLock
|
|
||||||
if (desktopLyric.isLock) {
|
|
||||||
global.modules.lyricWindow.setIgnoreMouseEvents(true, { forward: false })
|
|
||||||
} else {
|
|
||||||
global.modules.lyricWindow.setIgnoreMouseEvents(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isForceSet || isAlwaysOnTop != desktopLyric.isAlwaysOnTop) {
|
|
||||||
isAlwaysOnTop = desktopLyric.isAlwaysOnTop
|
|
||||||
global.modules.lyricWindow.setAlwaysOnTop(desktopLyric.isAlwaysOnTop, 'screen-saver')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
global.lx_event.common.on(COMMON_EVENT_NAME.config, name => {
|
global.lx_event.common.on(COMMON_EVENT_NAME.config, name => {
|
||||||
if (WIN_LYRIC_EVENT_NAME.name === name) return
|
if (WIN_LYRIC_EVENT_NAME.name === name) return
|
||||||
setLrcConfig(false)
|
setLrcConfig(false)
|
||||||
})
|
})
|
||||||
global.lx_event.winLyric.on(WIN_LYRIC_EVENT_NAME.inited, () => setLrcConfig(true))
|
// global.lx_event.winLyric.on(WIN_LYRIC_EVENT_NAME.inited, () => setLrcConfig(true))
|
||||||
|
|
||||||
global.lx_event.mainWindow.on(MAIN_WINDOW_EVENT_NAME.setLyricInfo, info => {
|
global.lx_event.mainWindow.on(MAIN_WINDOW_EVENT_NAME.setLyricInfo, info => {
|
||||||
if (!global.modules.lyricWindow) return
|
if (!global.modules.lyricWindow) return
|
||||||
|
|
|
@ -61,14 +61,9 @@ const winEvent = lyricWindow => {
|
||||||
|
|
||||||
lyricWindow.once('ready-to-show', () => {
|
lyricWindow.once('ready-to-show', () => {
|
||||||
lyricWindow.show()
|
lyricWindow.show()
|
||||||
let config = global.appSetting.desktopLyric
|
if (global.appSetting.desktopLyric.isLock) {
|
||||||
global.modules.lyricWindow.setBounds({
|
global.modules.lyricWindow.setIgnoreMouseEvents(true, { forward: false })
|
||||||
height: config.height,
|
}
|
||||||
width: config.width,
|
|
||||||
y: config.y,
|
|
||||||
x: config.x,
|
|
||||||
})
|
|
||||||
global.lx_event.winLyric.inited()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue