add open-setting in tray
This commit is contained in:
parent
3bd48e547d
commit
8612c07417
@ -135,6 +135,8 @@ const modules = {
|
||||
download_list_update: 'download_list_update',
|
||||
download_list_remove: 'download_list_remove',
|
||||
download_list_clear: 'download_list_clear',
|
||||
|
||||
on_open_setting:'on_open_setting'
|
||||
},
|
||||
winLyric: {
|
||||
close: 'close',
|
||||
|
||||
@ -5,9 +5,11 @@ import {
|
||||
hideWindow as hideMainWindow,
|
||||
isExistWindow as isExistMainWindow,
|
||||
isShowWindow as isShowMainWindow,
|
||||
sendEvent,
|
||||
showWindow as showMainWindow,
|
||||
} from './winMain'
|
||||
import { quitApp } from '@main/app'
|
||||
import { WIN_MAIN_RENDERER_EVENT_NAME } from '@common/ipcNames'
|
||||
|
||||
let tray: Electron.Tray | null
|
||||
let isEnableTray: boolean = false
|
||||
@ -87,6 +89,13 @@ export const createMenu = () => {
|
||||
showMainWindow()
|
||||
},
|
||||
})
|
||||
menu.push({
|
||||
label: '设置',
|
||||
click() {
|
||||
sendEvent(WIN_MAIN_RENDERER_EVENT_NAME.on_open_setting)
|
||||
showMainWindow()
|
||||
},
|
||||
})
|
||||
}
|
||||
menu.push(global.lx.appSetting['desktopLyric.enable']
|
||||
? {
|
||||
|
||||
@ -2,6 +2,7 @@ import { getFontSizeWithScreen } from '@renderer/utils'
|
||||
import {
|
||||
minWindow,
|
||||
onFocus,
|
||||
onOpenSetting,
|
||||
onSettingChanged,
|
||||
onThemeChange,
|
||||
openDevTools,
|
||||
@ -101,6 +102,10 @@ export default () => {
|
||||
window.app_event.configUpdate()
|
||||
})
|
||||
|
||||
const rOpenSetting = onOpenSetting(({}) => {
|
||||
window.location.href="#/setting"
|
||||
})
|
||||
|
||||
const rFocus = onFocus(() => {
|
||||
clearDownKeys()
|
||||
})
|
||||
@ -140,5 +145,6 @@ export default () => {
|
||||
rSetConfig()
|
||||
rFocus()
|
||||
rThemeChange()
|
||||
rOpenSetting()
|
||||
})
|
||||
}
|
||||
|
||||
@ -20,6 +20,13 @@ export const onSettingChanged = (listener: LX.IpcRendererEventListenerParams<Par
|
||||
}
|
||||
}
|
||||
|
||||
export const onOpenSetting = (listener: LX.IpcRendererEventListenerParams<Partial<LX.AppSetting>>): RemoveListener => {
|
||||
rendererOn(WIN_MAIN_RENDERER_EVENT_NAME.on_open_setting, listener)
|
||||
return () => {
|
||||
rendererOff(WIN_MAIN_RENDERER_EVENT_NAME.on_open_setting, listener)
|
||||
}
|
||||
}
|
||||
|
||||
export const sendInited = () => {
|
||||
return rendererSend(WIN_MAIN_RENDERER_EVENT_NAME.inited)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user