diff --git a/src/common/defaultSetting.ts b/src/common/defaultSetting.ts index 0b6a3346..3e8c3111 100644 --- a/src/common/defaultSetting.ts +++ b/src/common/defaultSetting.ts @@ -72,6 +72,7 @@ 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, diff --git a/src/common/types/app_setting.d.ts b/src/common/types/app_setting.d.ts index b61467d6..09b4bfef 100644 --- a/src/common/types/app_setting.d.ts +++ b/src/common/types/app_setting.d.ts @@ -319,6 +319,11 @@ declare global { */ 'desktopLyric.isShowTaskbar': boolean + /** + * 是否将歌词进程显示在状态栏 + */ + 'desktopLyric.isShowStatusBar': boolean + /** * 是否启用音频可视化 */ diff --git a/src/common/types/desktop_lyric.d.ts b/src/common/types/desktop_lyric.d.ts index feb0f49a..5ecc2523 100644 --- a/src/common/types/desktop_lyric.d.ts +++ b/src/common/types/desktop_lyric.d.ts @@ -6,6 +6,7 @@ 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'] diff --git a/src/lang/en-us.json b/src/lang/en-us.json index 60dcda47..c3d7fc8b 100644 --- a/src/lang/en-us.json +++ b/src/lang/en-us.json @@ -388,6 +388,7 @@ "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", diff --git a/src/lang/zh-cn.json b/src/lang/zh-cn.json index 7ee6a364..9277e083 100644 --- a/src/lang/zh-cn.json +++ b/src/lang/zh-cn.json @@ -388,6 +388,7 @@ "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": "保存", diff --git a/src/lang/zh-tw.json b/src/lang/zh-tw.json index 07fc0e20..d37be78f 100644 --- a/src/lang/zh-tw.json +++ b/src/lang/zh-tw.json @@ -388,6 +388,7 @@ "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": "儲存", diff --git a/src/main/modules/tray.ts b/src/main/modules/tray.ts index 310b5f69..8455c403 100644 --- a/src/main/modules/tray.ts +++ b/src/main/modules/tray.ts @@ -13,6 +13,7 @@ import { quitApp } from '@main/app' let tray: Electron.Tray | null let isEnableTray: boolean = false let themeId: number +let isShowStatusBar: boolean = false const playerState = { empty: false, @@ -26,6 +27,7 @@ const watchConfigKeys = [ 'desktopLyric.enable', 'desktopLyric.isLock', 'desktopLyric.isAlwaysOnTop', + 'desktopLyric.isShowStatusBar', 'tray.themeId', 'tray.enable', 'common.langId', @@ -124,7 +126,7 @@ const getIconPath = (id: number) => { export const createTray = () => { // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - if ((tray && !tray.isDestroyed()) || !global.lx.appSetting['tray.enable']) return + if ((tray && !tray.isDestroyed())) return // 托盘 tray = new Tray(nativeImage.createFromPath(getIconPath(global.lx.appSetting['tray.themeId']))) @@ -141,6 +143,7 @@ export const destroyTray = () => { if (!tray) return tray.destroy() isEnableTray = false + isShowStatusBar = false tray = null } @@ -268,9 +271,10 @@ const init = () => { themeId = global.lx.appSetting['tray.themeId'] setTrayImage(themeId) } - if (isEnableTray !== global.lx.appSetting['tray.enable']) { + if (isEnableTray !== global.lx.appSetting['tray.enable'] || isShowStatusBar !== global.lx.appSetting['desktopLyric.isShowStatusBar']) { isEnableTray = global.lx.appSetting['tray.enable'] - global.lx.appSetting['tray.enable'] ? createTray() : destroyTray() + isShowStatusBar = global.lx.appSetting['desktopLyric.isShowStatusBar'] + global.lx.appSetting['tray.enable'] || global.lx.appSetting['desktopLyric.isShowStatusBar'] ? createTray() : destroyTray() } createMenu() } @@ -338,5 +342,8 @@ export default () => { updated = true } if (updated) init() + if (tray && isShowStatusBar && status.lyricLineText) { + tray.setTitle(status.lyricLineText) + } }) } diff --git a/src/main/modules/winLyric/utils.ts b/src/main/modules/winLyric/utils.ts index 722e62eb..f108c4a5 100644 --- a/src/main/modules/winLyric/utils.ts +++ b/src/main/modules/winLyric/utils.ts @@ -53,6 +53,7 @@ export const watchConfigKeys = [ 'desktopLyric.isAlwaysOnTop', 'desktopLyric.isAlwaysOnTopLoop', 'desktopLyric.isShowTaskbar', + 'desktopLyric.isShowStatusBar', 'desktopLyric.audioVisualization', 'desktopLyric.width', 'desktopLyric.height', diff --git a/src/renderer-lyric/store/state.ts b/src/renderer-lyric/store/state.ts index 3a7e87bf..87024d5b 100644 --- a/src/renderer-lyric/store/state.ts +++ b/src/renderer-lyric/store/state.ts @@ -6,6 +6,7 @@ export const setting = shallowReactive({ 'desktopLyric.isAlwaysOnTop': false, 'desktopLyric.isAlwaysOnTopLoop': false, 'desktopLyric.isShowTaskbar': true, + 'desktopLyric.isShowStatusBar': false, 'desktopLyric.audioVisualization': false, 'desktopLyric.width': 450, 'desktopLyric.height': 300, diff --git a/src/renderer/views/Setting/components/SettingDesktopLyric.vue b/src/renderer/views/Setting/components/SettingDesktopLyric.vue index 50b8d2d6..bce48d12 100644 --- a/src/renderer/views/Setting/components/SettingDesktopLyric.vue +++ b/src/renderer/views/Setting/components/SettingDesktopLyric.vue @@ -15,6 +15,8 @@ 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 @@ -93,7 +95,7 @@ dd