修复桌面歌词在关闭软件时被重置回关闭状态的问题
This commit is contained in:
+3
-2
@@ -204,7 +204,8 @@ export const initAppSetting = async() => {
|
||||
const config = await initHotKey()
|
||||
global.lx = {
|
||||
isTrafficLightClose: false,
|
||||
isQuitting: false,
|
||||
isSkipTrayQuit: false,
|
||||
// mainWindowClosed: true,
|
||||
event_app: createAppEvent(),
|
||||
event_list: createListEvent(),
|
||||
appSetting: defaultSetting,
|
||||
@@ -241,6 +242,6 @@ export const initAppSetting = async() => {
|
||||
}
|
||||
|
||||
export const quitApp = () => {
|
||||
global.lx.isQuitting = true
|
||||
global.lx.isSkipTrayQuit = true
|
||||
closeWindow()
|
||||
}
|
||||
|
||||
@@ -17,23 +17,16 @@ const setLyricsConfig = debounce((config: Partial<LX.AppSetting>) => {
|
||||
|
||||
const winEvent = () => {
|
||||
if (!browserWindow) return
|
||||
// let bounds
|
||||
// lyricWindow.on('close', event => {
|
||||
// if (global.isQuitting || !global.appSetting.tray.enable || (!isWin && !global.isTrafficLightClose)) {
|
||||
// lyricWindow.setProgressBar(-1)
|
||||
// return
|
||||
// }
|
||||
|
||||
// if (global.isTrafficLightClose) global.isTrafficLightClose = false
|
||||
// event.preventDefault()
|
||||
// lyricWindow.hide()
|
||||
// browserWindow.on('close', () => {
|
||||
// if (global.lx.appSetting['desktopLyric.enable'] && !global.lx.mainWindowClosed) {
|
||||
// browserWindow = null
|
||||
// global.lx.event_app.update_config({ 'desktopLyric.enable': false })
|
||||
// }
|
||||
// })
|
||||
|
||||
browserWindow.on('closed', () => {
|
||||
browserWindow = null
|
||||
if (global.lx.appSetting['desktopLyric.enable']) {
|
||||
global.lx.event_app.update_config({ 'desktopLyric.enable': false })
|
||||
}
|
||||
})
|
||||
|
||||
browserWindow.on('move', () => {
|
||||
|
||||
@@ -109,7 +109,7 @@ export default () => {
|
||||
})
|
||||
|
||||
mainOn(WIN_MAIN_RENDERER_EVENT_NAME.quit_update, () => {
|
||||
global.lx.isQuitting = true
|
||||
global.lx.isSkipTrayQuit = true
|
||||
|
||||
setTimeout(() => {
|
||||
autoUpdater.quitAndInstall(true, true)
|
||||
|
||||
@@ -13,8 +13,9 @@ const winEvent = () => {
|
||||
if (!browserWindow) return
|
||||
|
||||
browserWindow.on('close', event => {
|
||||
if (global.lx.isQuitting || !global.lx.appSetting['tray.enable'] || (!isWin && !global.lx.isTrafficLightClose)) {
|
||||
if (global.lx.isSkipTrayQuit || !global.lx.appSetting['tray.enable'] || (!isWin && !global.lx.isTrafficLightClose)) {
|
||||
browserWindow!.setProgressBar(-1)
|
||||
// global.lx.mainWindowClosed = true
|
||||
global.lx.event_app.main_window_close()
|
||||
return
|
||||
}
|
||||
@@ -25,6 +26,7 @@ const winEvent = () => {
|
||||
})
|
||||
|
||||
browserWindow.on('closed', () => {
|
||||
// global.lx.mainWindowClosed = true
|
||||
browserWindow = null
|
||||
})
|
||||
|
||||
@@ -100,6 +102,8 @@ export const createWindow = () => {
|
||||
winEvent()
|
||||
|
||||
if (global.envParams.cmdParams.odt) handleOpenDevTools(browserWindow.webContents)
|
||||
|
||||
// global.lx.mainWindowClosed = false
|
||||
// browserWindow.webContents.openDevTools()
|
||||
}
|
||||
|
||||
|
||||
Vendored
+11
-1
@@ -11,8 +11,18 @@ interface Lx {
|
||||
config: LX.HotKeyConfigAll
|
||||
state: LX.HotKeyState
|
||||
}
|
||||
/**
|
||||
* 是否红绿灯关闭
|
||||
*/
|
||||
isTrafficLightClose: boolean
|
||||
isQuitting: boolean
|
||||
/**
|
||||
* 是否跳过托盘退出
|
||||
*/
|
||||
isSkipTrayQuit: boolean
|
||||
/**
|
||||
* main window 是否关闭
|
||||
*/
|
||||
// mainWindowClosed: boolean
|
||||
event_app: AppType
|
||||
event_list: ListType
|
||||
worker: {
|
||||
|
||||
Vendored
-11
@@ -1,16 +1,5 @@
|
||||
|
||||
|
||||
// interface Lx {
|
||||
// appSetting: LX.AppSetting
|
||||
// hotKey: {
|
||||
// enable: boolean
|
||||
// config: LX.HotKeyConfigAll
|
||||
// state: LX.HotKeyState
|
||||
// }
|
||||
// isTrafficLightClose: boolean
|
||||
// isQuitting: boolean
|
||||
// }
|
||||
|
||||
// // declare module NodeJS {
|
||||
// // interface Global {
|
||||
// // isDev: boolean
|
||||
|
||||
@@ -36,7 +36,7 @@ export const addSongListDetail = async(id: string, name: string, source: LX.Onli
|
||||
|
||||
export const playSongListDetail = async(id: string, list?: LX.Music.MusicInfoOnline[], index: number = 0) => {
|
||||
let isPlayingList = false
|
||||
console.log(list)
|
||||
// console.log(list)
|
||||
const listId = getListId(id)
|
||||
if (!list?.length) list = (await getListDetail(id, 1)).list
|
||||
if (list?.length) {
|
||||
|
||||
@@ -36,7 +36,7 @@ export const addSongListDetail = async(id: string, source: LX.OnlineSource, name
|
||||
|
||||
export const playSongListDetail = async(id: string, source: LX.OnlineSource, list?: LX.Music.MusicInfoOnline[], index: number = 0) => {
|
||||
let isPlayingList = false
|
||||
console.log(list)
|
||||
// console.log(list)
|
||||
const listId = getListId(id, source)
|
||||
if (!list?.length) list = (await getListDetail(id, source, 1)).list
|
||||
if (list?.length) {
|
||||
|
||||
Reference in New Issue
Block a user