桌面歌词新增在任务栏显示歌词进程设置(#1063)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { isLinux } from '@common/utils'
|
||||
import { closeWindow, createWindow, getBounds, isExistWindow, alwaysOnTopTools, setBounds, setIgnoreMouseEvents } from './main'
|
||||
import { closeWindow, createWindow, getBounds, isExistWindow, alwaysOnTopTools, setBounds, setIgnoreMouseEvents, setSkipTaskbar } from './main'
|
||||
import { sendConfigChange } from './rendererEvent'
|
||||
import { buildLyricConfig, getLyricWindowBounds, watchConfigKeys } from './utils'
|
||||
|
||||
@@ -7,6 +7,7 @@ let isLock: boolean
|
||||
let isEnable: boolean
|
||||
let isAlwaysOnTop: boolean
|
||||
let isAlwaysOnTopLoop: boolean
|
||||
let isShowTaskbar: boolean
|
||||
let isLockScreen: boolean
|
||||
let isHoverHide: boolean
|
||||
|
||||
@@ -37,6 +38,10 @@ export const setLrcConfig = (keys: Array<keyof LX.AppSetting>, setting: Partial<
|
||||
alwaysOnTopTools.startLoop()
|
||||
} else alwaysOnTopTools.clearLoop()
|
||||
}
|
||||
if (keys.includes('desktopLyric.isShowTaskbar') && isShowTaskbar != global.lx.appSetting['desktopLyric.isShowTaskbar']) {
|
||||
isShowTaskbar = global.lx.appSetting['desktopLyric.isShowTaskbar']
|
||||
setSkipTaskbar(!global.lx.appSetting['desktopLyric.isShowTaskbar'])
|
||||
}
|
||||
if (keys.includes('desktopLyric.isAlwaysOnTopLoop') && isAlwaysOnTopLoop != global.lx.appSetting['desktopLyric.isAlwaysOnTopLoop']) {
|
||||
isAlwaysOnTopLoop = global.lx.appSetting['desktopLyric.isAlwaysOnTopLoop']
|
||||
if (!global.lx.appSetting['desktopLyric.isAlwaysOnTop']) return
|
||||
|
||||
@@ -31,6 +31,9 @@ const winEvent = () => {
|
||||
|
||||
browserWindow.on('closed', () => {
|
||||
browserWindow = null
|
||||
if (global.lx.appSetting['desktopLyric.enable']) {
|
||||
global.lx.event_app.update_config({ 'desktopLyric.enable': false })
|
||||
}
|
||||
})
|
||||
|
||||
browserWindow.on('move', () => {
|
||||
@@ -86,6 +89,7 @@ export const createWindow = () => {
|
||||
let height = global.lx.appSetting['desktopLyric.height']
|
||||
let isAlwaysOnTop = global.lx.appSetting['desktopLyric.isAlwaysOnTop']
|
||||
let isLockScreen = global.lx.appSetting['desktopLyric.isLockScreen']
|
||||
let isShowTaskbar = global.lx.appSetting['desktopLyric.isShowTaskbar']
|
||||
let { width: screenWidth, height: screenHeight } = global.envParams.workAreaSize
|
||||
if (x == null || y == null) {
|
||||
x = screenWidth - width
|
||||
@@ -122,7 +126,7 @@ export const createWindow = () => {
|
||||
fullscreenable: false,
|
||||
show: false,
|
||||
alwaysOnTop: isAlwaysOnTop,
|
||||
skipTaskbar: true,
|
||||
skipTaskbar: !isShowTaskbar,
|
||||
webPreferences: {
|
||||
contextIsolation: false,
|
||||
webSecurity: false,
|
||||
@@ -173,6 +177,11 @@ export const setIgnoreMouseEvents = (ignore: boolean, options?: Electron.IgnoreM
|
||||
browserWindow.setIgnoreMouseEvents(ignore, options)
|
||||
}
|
||||
|
||||
export const setSkipTaskbar = (skip: boolean) => {
|
||||
if (!browserWindow) return
|
||||
browserWindow.setSkipTaskbar(skip)
|
||||
}
|
||||
|
||||
export const setAlwaysOnTop = (flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver' | undefined, relativeLevel?: number | undefined) => {
|
||||
if (!browserWindow) return
|
||||
browserWindow.setAlwaysOnTop(flag, level, relativeLevel)
|
||||
|
||||
@@ -80,6 +80,7 @@ export const watchConfigKeys = [
|
||||
'desktopLyric.isLock',
|
||||
'desktopLyric.isAlwaysOnTop',
|
||||
'desktopLyric.isAlwaysOnTopLoop',
|
||||
'desktopLyric.isShowTaskbar',
|
||||
'desktopLyric.audioVisualization',
|
||||
'desktopLyric.width',
|
||||
'desktopLyric.height',
|
||||
|
||||
Reference in New Issue
Block a user