update
This commit is contained in:
parent
080150acc9
commit
5423630411
@ -26,6 +26,7 @@ const defaultSetting: LX.AppSetting = {
|
||||
'player.togglePlayMethod': 'listLoop',
|
||||
'player.playQuality': '128k',
|
||||
'player.isShowTaskProgess': true,
|
||||
'player.isShowStatusBarLyric': false,
|
||||
'player.volume': 1,
|
||||
'player.powerSaveBlocker': true,
|
||||
'player.isMute': false,
|
||||
@ -72,7 +73,6 @@ const defaultSetting: LX.AppSetting = {
|
||||
'desktopLyric.isAlwaysOnTop': false,
|
||||
'desktopLyric.isAlwaysOnTopLoop': false,
|
||||
'desktopLyric.isShowTaskbar': false,
|
||||
'desktopLyric.isShowStatusBar': false,
|
||||
'desktopLyric.audioVisualization': false,
|
||||
'desktopLyric.fullscreenHide': true,
|
||||
'desktopLyric.width': 450,
|
||||
|
||||
11
src/common/types/app_setting.d.ts
vendored
11
src/common/types/app_setting.d.ts
vendored
@ -98,6 +98,12 @@ declare global {
|
||||
*/
|
||||
'player.isShowTaskProgess': boolean
|
||||
|
||||
|
||||
/**
|
||||
* 是否将将歌词显示在状态栏
|
||||
*/
|
||||
'player.isShowStatusBarLyric': boolean
|
||||
|
||||
/**
|
||||
* 音量大小
|
||||
*/
|
||||
@ -319,11 +325,6 @@ declare global {
|
||||
*/
|
||||
'desktopLyric.isShowTaskbar': boolean
|
||||
|
||||
/**
|
||||
* 是否将歌词进程显示在状态栏
|
||||
*/
|
||||
'desktopLyric.isShowStatusBar': boolean
|
||||
|
||||
/**
|
||||
* 是否启用音频可视化
|
||||
*/
|
||||
|
||||
1
src/common/types/desktop_lyric.d.ts
vendored
1
src/common/types/desktop_lyric.d.ts
vendored
@ -6,7 +6,6 @@ declare namespace LX {
|
||||
'desktopLyric.isAlwaysOnTop': LX.AppSetting['desktopLyric.isAlwaysOnTop']
|
||||
'desktopLyric.isAlwaysOnTopLoop': LX.AppSetting['desktopLyric.isAlwaysOnTopLoop']
|
||||
'desktopLyric.isShowTaskbar': LX.AppSetting['desktopLyric.isShowTaskbar']
|
||||
'desktopLyric.isShowStatusBar': LX.AppSetting['desktopLyric.isShowStatusBar']
|
||||
'desktopLyric.audioVisualization': LX.AppSetting['desktopLyric.audioVisualization']
|
||||
'desktopLyric.width': LX.AppSetting['desktopLyric.width']
|
||||
'desktopLyric.height': LX.AppSetting['desktopLyric.height']
|
||||
|
||||
@ -388,7 +388,6 @@
|
||||
"setting__desktop_lyric_scroll_align_top": "Top",
|
||||
"setting__desktop_lyric_shadow_color": "Shadow color",
|
||||
"setting__desktop_lyric_show_taskbar": "Display lyrics progress on the taskbar (this setting is used as a workaround when the screen recording software cannot capture the lyrics window)",
|
||||
"setting__desktop_lyric_show_status_bar": "Display lyrics progress on the Menu Bar",
|
||||
"setting__desktop_lyric_unplay_color": "Color not playing",
|
||||
"setting__dislike_list_input_tip": "song name@artist name\nSong name\n@ singer name",
|
||||
"setting__dislike_list_save_btn": "Save",
|
||||
@ -527,6 +526,7 @@
|
||||
"setting__play_power_save_blocker": "Prevent computer from sleeping while playing songs",
|
||||
"setting__play_save_play_time": "Remember playback progress",
|
||||
"setting__play_startup_auto_play": "Play music automatically after launching the software",
|
||||
"setting__play_statusbar_lyric": "Show lyrics in status bar (needs tray enabled)",
|
||||
"setting__play_task_bar": "Show playing progress on the taskbar",
|
||||
"setting__play_timeout": "Timed pause",
|
||||
"setting__player_audio_visualization_tip": "The custom audio output device will conflict with the audio visualization function. After the audio visualization is enabled, the audio output device will be reset to the default output device. At present, this problem cannot be solved. Do you still want to enable it?",
|
||||
|
||||
@ -388,7 +388,6 @@
|
||||
"setting__desktop_lyric_scroll_align_top": "顶部",
|
||||
"setting__desktop_lyric_shadow_color": "阴影颜色",
|
||||
"setting__desktop_lyric_show_taskbar": "在任务栏显示歌词进程(此设置用于在录屏软件无法捕获歌词窗口时的变通解决方法)",
|
||||
"setting__desktop_lyric_show_status_bar": "在状态栏显示歌词进程",
|
||||
"setting__desktop_lyric_unplay_color": "未播放颜色",
|
||||
"setting__dislike_list_input_tip": "歌曲名@歌手名\n歌曲名\n@歌手名",
|
||||
"setting__dislike_list_save_btn": "保存",
|
||||
@ -527,6 +526,7 @@
|
||||
"setting__play_power_save_blocker": "播放歌曲时阻止电脑休眠",
|
||||
"setting__play_save_play_time": "记住播放进度",
|
||||
"setting__play_startup_auto_play": "启动软件后自动播放音乐",
|
||||
"setting__play_statusbar_lyric": "在状态栏显示歌词(需要启用托盘)",
|
||||
"setting__play_task_bar": "在任务栏上显示当前歌曲播放进度",
|
||||
"setting__play_timeout": "定时暂停",
|
||||
"setting__player_audio_visualization_tip": "自定义音频输出设备与音频可视化功能会冲突,启用了音频可视化后音频输出设备将会被重置为默认的输出设备,目前此问题暂无法解决,是否仍要开启?",
|
||||
|
||||
@ -388,7 +388,6 @@
|
||||
"setting__desktop_lyric_scroll_align_top": "頂部",
|
||||
"setting__desktop_lyric_shadow_color": "陰影顏色",
|
||||
"setting__desktop_lyric_show_taskbar": "在工作列顯示歌詞進程(此設定用於在錄影軟體無法擷取歌詞視窗時的變通解決方法)",
|
||||
"setting__desktop_lyric_show_status_bar": "在狀態列顯示歌詞進程",
|
||||
"setting__desktop_lyric_unplay_color": "未播放顏色",
|
||||
"setting__dislike_list_input_tip": "歌曲名@歌手名\n歌曲名\n@歌手名",
|
||||
"setting__dislike_list_save_btn": "儲存",
|
||||
@ -527,6 +526,7 @@
|
||||
"setting__play_power_save_blocker": "播放歌曲時阻止電腦休眠",
|
||||
"setting__play_save_play_time": "記住播放進度",
|
||||
"setting__play_startup_auto_play": "啟動軟體後自動播放音樂",
|
||||
"setting__play_statusbar_lyric": "在狀態列顯示歌詞(需要啟用托盤)",
|
||||
"setting__play_task_bar": "在工作列上顯示目前歌曲播放進度",
|
||||
"setting__play_timeout": "定時暫停",
|
||||
"setting__player_audio_visualization_tip": "自訂音訊輸出設備與音訊視覺化功能會衝突,啟用了音訊視覺化後音訊輸出設備將會被重設為預設的輸出設備,目前此問題暫無法解決,是否仍要開啟?",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Tray, Menu, nativeImage } from 'electron'
|
||||
import { isWin } from '@common/utils'
|
||||
import { isMac, isWin } from '@common/utils'
|
||||
import path from 'node:path'
|
||||
import {
|
||||
hideWindow as hideMainWindow,
|
||||
@ -13,7 +13,7 @@ import { quitApp } from '@main/app'
|
||||
let tray: Electron.Tray | null
|
||||
let isEnableTray: boolean = false
|
||||
let themeId: number
|
||||
let isShowStatusBar: boolean = false
|
||||
let isShowStatusBarLyric: boolean = false
|
||||
|
||||
const playerState = {
|
||||
empty: false,
|
||||
@ -27,9 +27,9 @@ const watchConfigKeys = [
|
||||
'desktopLyric.enable',
|
||||
'desktopLyric.isLock',
|
||||
'desktopLyric.isAlwaysOnTop',
|
||||
'desktopLyric.isShowStatusBar',
|
||||
'tray.themeId',
|
||||
'tray.enable',
|
||||
'player.isShowStatusBarLyric',
|
||||
'common.langId',
|
||||
] satisfies Array<keyof LX.AppSetting>
|
||||
|
||||
@ -67,6 +67,8 @@ const messages = {
|
||||
unlock_win_lyric: 'Unlock desktop lyrics',
|
||||
top_win_lyric: 'Set top lyrics',
|
||||
untop_win_lyric: 'Cancel top lyrics',
|
||||
show_statusbar_lyric: 'Show statusbar lyric',
|
||||
hide_statusbar_lyric: 'Hide statusbar lyric',
|
||||
exit: 'Exit',
|
||||
},
|
||||
'zh-cn': {
|
||||
@ -84,6 +86,8 @@ const messages = {
|
||||
unlock_win_lyric: '解锁桌面歌词',
|
||||
top_win_lyric: '置顶歌词',
|
||||
untop_win_lyric: '取消置顶',
|
||||
show_statusbar_lyric: '显示状态栏歌词',
|
||||
hide_statusbar_lyric: '隐藏状态栏歌词',
|
||||
exit: '退出',
|
||||
},
|
||||
'zh-tw': {
|
||||
@ -101,6 +105,8 @@ const messages = {
|
||||
unlock_win_lyric: '解鎖桌面歌詞',
|
||||
top_win_lyric: '置頂歌詞',
|
||||
untop_win_lyric: '取消置頂',
|
||||
show_statusbar_lyric: '顯示狀態列歌詞',
|
||||
hide_statusbar_lyric: '隱藏狀態列歌詞',
|
||||
exit: '退出',
|
||||
},
|
||||
} as const
|
||||
@ -126,7 +132,7 @@ const getIconPath = (id: number) => {
|
||||
|
||||
export const createTray = () => {
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||
if ((tray && !tray.isDestroyed())) return
|
||||
if ((tray && !tray.isDestroyed()) || !global.lx.appSetting['tray.enable']) return
|
||||
|
||||
// 托盘
|
||||
tray = new Tray(nativeImage.createFromPath(getIconPath(global.lx.appSetting['tray.themeId'])))
|
||||
@ -143,12 +149,12 @@ export const destroyTray = () => {
|
||||
if (!tray) return
|
||||
tray.destroy()
|
||||
isEnableTray = false
|
||||
isShowStatusBar = false
|
||||
isShowStatusBarLyric = false
|
||||
tray = null
|
||||
}
|
||||
|
||||
const handleUpdateConfig = (config: any) => {
|
||||
global.lx.event_app.update_config(config)
|
||||
const handleUpdateConfig = (setting: Partial<LX.AppSetting>) => {
|
||||
global.lx.event_app.update_config(setting)
|
||||
}
|
||||
|
||||
const createPlayerMenu = () => {
|
||||
@ -234,6 +240,22 @@ export const createMenu = () => {
|
||||
handleUpdateConfig({ 'desktopLyric.isAlwaysOnTop': true })
|
||||
},
|
||||
})
|
||||
if (isMac) {
|
||||
menu.push({ type: 'separator' })
|
||||
menu.push(isShowStatusBarLyric
|
||||
? {
|
||||
label: i18n.getMessage('hide_statusbar_lyric'),
|
||||
click() {
|
||||
handleUpdateConfig({ 'player.isShowStatusBarLyric': false })
|
||||
},
|
||||
}
|
||||
: {
|
||||
label: i18n.getMessage('show_statusbar_lyric'),
|
||||
click() {
|
||||
handleUpdateConfig({ 'player.isShowStatusBarLyric': true })
|
||||
},
|
||||
})
|
||||
}
|
||||
menu.push({ type: 'separator' })
|
||||
if (isExistMainWindow()) {
|
||||
const isShow = isShowMainWindow()
|
||||
@ -266,15 +288,28 @@ export const setTrayImage = (themeId: number) => {
|
||||
tray.setImage(nativeImage.createFromPath(getIconPath(themeId)))
|
||||
}
|
||||
|
||||
const setLyric = (lyricLineText?: string) => {
|
||||
if (isShowStatusBarLyric && tray && lyricLineText != null) {
|
||||
tray.setTitle(lyricLineText)
|
||||
}
|
||||
}
|
||||
|
||||
const init = () => {
|
||||
if (themeId != global.lx.appSetting['tray.themeId']) {
|
||||
themeId = global.lx.appSetting['tray.themeId']
|
||||
setTrayImage(themeId)
|
||||
}
|
||||
if (isEnableTray !== global.lx.appSetting['tray.enable'] || isShowStatusBar !== global.lx.appSetting['desktopLyric.isShowStatusBar']) {
|
||||
if (isEnableTray !== global.lx.appSetting['tray.enable']) {
|
||||
isEnableTray = global.lx.appSetting['tray.enable']
|
||||
isShowStatusBar = global.lx.appSetting['desktopLyric.isShowStatusBar']
|
||||
global.lx.appSetting['tray.enable'] || global.lx.appSetting['desktopLyric.isShowStatusBar'] ? createTray() : destroyTray()
|
||||
global.lx.appSetting['tray.enable'] ? createTray() : destroyTray()
|
||||
}
|
||||
if (isShowStatusBarLyric !== global.lx.appSetting['player.isShowStatusBarLyric']) {
|
||||
isShowStatusBarLyric = global.lx.appSetting['player.isShowStatusBarLyric']
|
||||
if (isShowStatusBarLyric) {
|
||||
setLyric(global.lx.player_status.lyricLineText)
|
||||
} else {
|
||||
tray?.setTitle('')
|
||||
}
|
||||
}
|
||||
createMenu()
|
||||
}
|
||||
@ -321,29 +356,32 @@ export default () => {
|
||||
case 'paused':
|
||||
playerState.play = false
|
||||
playerState.empty &&= false
|
||||
setLyric('')
|
||||
break
|
||||
case 'error':
|
||||
playerState.play = false
|
||||
playerState.empty &&= false
|
||||
setLyric('')
|
||||
break
|
||||
case 'playing':
|
||||
playerState.play = true
|
||||
playerState.empty &&= false
|
||||
setLyric(global.lx.player_status.lyricLineText)
|
||||
break
|
||||
case 'stoped':
|
||||
playerState.play &&= false
|
||||
playerState.empty = true
|
||||
setLyric('')
|
||||
break
|
||||
}
|
||||
updated = true
|
||||
} else {
|
||||
setLyric(status.lyricLineText)
|
||||
}
|
||||
if (status.collect != null) {
|
||||
playerState.collect = status.collect
|
||||
updated = true
|
||||
}
|
||||
if (updated) init()
|
||||
if (tray && isShowStatusBar && status.lyricLineText) {
|
||||
tray.setTitle(status.lyricLineText)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -53,7 +53,6 @@ export const watchConfigKeys = [
|
||||
'desktopLyric.isAlwaysOnTop',
|
||||
'desktopLyric.isAlwaysOnTopLoop',
|
||||
'desktopLyric.isShowTaskbar',
|
||||
'desktopLyric.isShowStatusBar',
|
||||
'desktopLyric.audioVisualization',
|
||||
'desktopLyric.width',
|
||||
'desktopLyric.height',
|
||||
|
||||
@ -6,7 +6,6 @@ export const setting = shallowReactive<LX.DesktopLyric.Config>({
|
||||
'desktopLyric.isAlwaysOnTop': false,
|
||||
'desktopLyric.isAlwaysOnTopLoop': false,
|
||||
'desktopLyric.isShowTaskbar': true,
|
||||
'desktopLyric.isShowStatusBar': false,
|
||||
'desktopLyric.audioVisualization': false,
|
||||
'desktopLyric.width': 450,
|
||||
'desktopLyric.height': 300,
|
||||
|
||||
@ -15,8 +15,6 @@ dd
|
||||
base-checkbox(id="setting_desktop_lyric_alwaysOnTop" :model-value="appSetting['desktopLyric.isAlwaysOnTop']" :label="$t('setting__desktop_lyric_always_on_top')" @update:model-value="updateSetting({ 'desktopLyric.isAlwaysOnTop': $event })")
|
||||
.gap-top
|
||||
base-checkbox(id="setting_desktop_lyric_showTaskbar" :model-value="appSetting['desktopLyric.isShowTaskbar']" :label="$t('setting__desktop_lyric_show_taskbar')" @update:model-value="updateSetting({ 'desktopLyric.isShowTaskbar': $event })")
|
||||
.gap-top(v-if="isMac")
|
||||
base-checkbox(id="setting_desktop_lyric_showStatusBar" :model-value="appSetting['desktopLyric.isShowStatusBar']" :label="$t('setting__desktop_lyric_show_status_bar')" @update:model-value="updateSetting({ 'desktopLyric.isShowStatusBar': $event })")
|
||||
.gap-top
|
||||
base-checkbox(id="setting_desktop_lyric_alwaysOnTopLoop" :model-value="appSetting['desktopLyric.isAlwaysOnTopLoop']" :label="$t('setting__desktop_lyric_always_on_top_loop')" @update:model-value="updateSetting({ 'desktopLyric.isAlwaysOnTopLoop': $event })")
|
||||
.gap-top
|
||||
@ -95,7 +93,7 @@ dd
|
||||
<script>
|
||||
import { ref, computed, onMounted, onBeforeUnmount } from '@common/utils/vueTools'
|
||||
import { getSystemFonts } from '@renderer/utils/ipc'
|
||||
import { isLinux, isMac } from '@common/utils'
|
||||
import { isLinux } from '@common/utils'
|
||||
import { appSetting, updateSetting } from '@renderer/store/setting'
|
||||
import { useI18n } from '@renderer/plugins/i18n'
|
||||
import { pickrTools } from '@renderer/utils/pickrTools'
|
||||
@ -296,7 +294,6 @@ export default {
|
||||
|
||||
fontList,
|
||||
isLinux,
|
||||
isMac,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@ -21,6 +21,8 @@ dd
|
||||
base-checkbox(id="setting_player_lyric_play_lxlrc" :model-value="appSetting['player.isPlayLxlrc']" :label="$t('setting__play_lyric_lxlrc')" @update:model-value="updateSetting({'player.isPlayLxlrc': $event})")
|
||||
.gap-top
|
||||
base-checkbox(id="setting_player_showTaskProgess" :model-value="appSetting['player.isShowTaskProgess']" :label="$t('setting__play_task_bar')" @update:model-value="updateSetting({'player.isShowTaskProgess': $event})")
|
||||
.gap-top(v-if="isMac")
|
||||
base-checkbox(id="setting_player_showStatusBarLyric" :model-value="appSetting['player.isShowStatusBarLyric']" :label="$t('setting__play_statusbar_lyric')" @update:model-value="updateSetting({'player.isShowStatusBarLyric': $event})")
|
||||
.gap-top
|
||||
base-checkbox(id="setting_player_isMaxOutputChannelCount" :model-value="isMaxOutputChannelCount" :label="$t('setting__play_max_output_channel_count')" @update:model-value="handleUpdateMaxOutputChannelCount")
|
||||
.gap-top
|
||||
@ -49,6 +51,7 @@ import { appSetting, saveMediaDeviceId, updateSetting } from '@renderer/store/se
|
||||
import { setPowerSaveBlocker } from '@renderer/core/player/utils'
|
||||
import { isPlay } from '@renderer/store/player/state'
|
||||
import { TRY_QUALITYS_LIST } from '@renderer/core/music/utils'
|
||||
import { isMac } from '@common/utils'
|
||||
|
||||
|
||||
export default {
|
||||
@ -140,6 +143,7 @@ export default {
|
||||
isMaxOutputChannelCount,
|
||||
handleUpdateMaxOutputChannelCount,
|
||||
playQualityList,
|
||||
isMac,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user