feat: macOS状态栏增加歌词显示
This commit is contained in:
parent
de5ea4f0aa
commit
080150acc9
@ -72,6 +72,7 @@ const defaultSetting: LX.AppSetting = {
|
|||||||
'desktopLyric.isAlwaysOnTop': false,
|
'desktopLyric.isAlwaysOnTop': false,
|
||||||
'desktopLyric.isAlwaysOnTopLoop': false,
|
'desktopLyric.isAlwaysOnTopLoop': false,
|
||||||
'desktopLyric.isShowTaskbar': false,
|
'desktopLyric.isShowTaskbar': false,
|
||||||
|
'desktopLyric.isShowStatusBar': false,
|
||||||
'desktopLyric.audioVisualization': false,
|
'desktopLyric.audioVisualization': false,
|
||||||
'desktopLyric.fullscreenHide': true,
|
'desktopLyric.fullscreenHide': true,
|
||||||
'desktopLyric.width': 450,
|
'desktopLyric.width': 450,
|
||||||
|
|||||||
5
src/common/types/app_setting.d.ts
vendored
5
src/common/types/app_setting.d.ts
vendored
@ -319,6 +319,11 @@ declare global {
|
|||||||
*/
|
*/
|
||||||
'desktopLyric.isShowTaskbar': boolean
|
'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,6 +6,7 @@ declare namespace LX {
|
|||||||
'desktopLyric.isAlwaysOnTop': LX.AppSetting['desktopLyric.isAlwaysOnTop']
|
'desktopLyric.isAlwaysOnTop': LX.AppSetting['desktopLyric.isAlwaysOnTop']
|
||||||
'desktopLyric.isAlwaysOnTopLoop': LX.AppSetting['desktopLyric.isAlwaysOnTopLoop']
|
'desktopLyric.isAlwaysOnTopLoop': LX.AppSetting['desktopLyric.isAlwaysOnTopLoop']
|
||||||
'desktopLyric.isShowTaskbar': LX.AppSetting['desktopLyric.isShowTaskbar']
|
'desktopLyric.isShowTaskbar': LX.AppSetting['desktopLyric.isShowTaskbar']
|
||||||
|
'desktopLyric.isShowStatusBar': LX.AppSetting['desktopLyric.isShowStatusBar']
|
||||||
'desktopLyric.audioVisualization': LX.AppSetting['desktopLyric.audioVisualization']
|
'desktopLyric.audioVisualization': LX.AppSetting['desktopLyric.audioVisualization']
|
||||||
'desktopLyric.width': LX.AppSetting['desktopLyric.width']
|
'desktopLyric.width': LX.AppSetting['desktopLyric.width']
|
||||||
'desktopLyric.height': LX.AppSetting['desktopLyric.height']
|
'desktopLyric.height': LX.AppSetting['desktopLyric.height']
|
||||||
|
|||||||
@ -388,6 +388,7 @@
|
|||||||
"setting__desktop_lyric_scroll_align_top": "Top",
|
"setting__desktop_lyric_scroll_align_top": "Top",
|
||||||
"setting__desktop_lyric_shadow_color": "Shadow color",
|
"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_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__desktop_lyric_unplay_color": "Color not playing",
|
||||||
"setting__dislike_list_input_tip": "song name@artist name\nSong name\n@ singer name",
|
"setting__dislike_list_input_tip": "song name@artist name\nSong name\n@ singer name",
|
||||||
"setting__dislike_list_save_btn": "Save",
|
"setting__dislike_list_save_btn": "Save",
|
||||||
|
|||||||
@ -388,6 +388,7 @@
|
|||||||
"setting__desktop_lyric_scroll_align_top": "顶部",
|
"setting__desktop_lyric_scroll_align_top": "顶部",
|
||||||
"setting__desktop_lyric_shadow_color": "阴影颜色",
|
"setting__desktop_lyric_shadow_color": "阴影颜色",
|
||||||
"setting__desktop_lyric_show_taskbar": "在任务栏显示歌词进程(此设置用于在录屏软件无法捕获歌词窗口时的变通解决方法)",
|
"setting__desktop_lyric_show_taskbar": "在任务栏显示歌词进程(此设置用于在录屏软件无法捕获歌词窗口时的变通解决方法)",
|
||||||
|
"setting__desktop_lyric_show_status_bar": "在状态栏显示歌词进程",
|
||||||
"setting__desktop_lyric_unplay_color": "未播放颜色",
|
"setting__desktop_lyric_unplay_color": "未播放颜色",
|
||||||
"setting__dislike_list_input_tip": "歌曲名@歌手名\n歌曲名\n@歌手名",
|
"setting__dislike_list_input_tip": "歌曲名@歌手名\n歌曲名\n@歌手名",
|
||||||
"setting__dislike_list_save_btn": "保存",
|
"setting__dislike_list_save_btn": "保存",
|
||||||
|
|||||||
@ -388,6 +388,7 @@
|
|||||||
"setting__desktop_lyric_scroll_align_top": "頂部",
|
"setting__desktop_lyric_scroll_align_top": "頂部",
|
||||||
"setting__desktop_lyric_shadow_color": "陰影顏色",
|
"setting__desktop_lyric_shadow_color": "陰影顏色",
|
||||||
"setting__desktop_lyric_show_taskbar": "在工作列顯示歌詞進程(此設定用於在錄影軟體無法擷取歌詞視窗時的變通解決方法)",
|
"setting__desktop_lyric_show_taskbar": "在工作列顯示歌詞進程(此設定用於在錄影軟體無法擷取歌詞視窗時的變通解決方法)",
|
||||||
|
"setting__desktop_lyric_show_status_bar": "在狀態列顯示歌詞進程",
|
||||||
"setting__desktop_lyric_unplay_color": "未播放顏色",
|
"setting__desktop_lyric_unplay_color": "未播放顏色",
|
||||||
"setting__dislike_list_input_tip": "歌曲名@歌手名\n歌曲名\n@歌手名",
|
"setting__dislike_list_input_tip": "歌曲名@歌手名\n歌曲名\n@歌手名",
|
||||||
"setting__dislike_list_save_btn": "儲存",
|
"setting__dislike_list_save_btn": "儲存",
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import { quitApp } from '@main/app'
|
|||||||
let tray: Electron.Tray | null
|
let tray: Electron.Tray | null
|
||||||
let isEnableTray: boolean = false
|
let isEnableTray: boolean = false
|
||||||
let themeId: number
|
let themeId: number
|
||||||
|
let isShowStatusBar: boolean = false
|
||||||
|
|
||||||
const playerState = {
|
const playerState = {
|
||||||
empty: false,
|
empty: false,
|
||||||
@ -26,6 +27,7 @@ const watchConfigKeys = [
|
|||||||
'desktopLyric.enable',
|
'desktopLyric.enable',
|
||||||
'desktopLyric.isLock',
|
'desktopLyric.isLock',
|
||||||
'desktopLyric.isAlwaysOnTop',
|
'desktopLyric.isAlwaysOnTop',
|
||||||
|
'desktopLyric.isShowStatusBar',
|
||||||
'tray.themeId',
|
'tray.themeId',
|
||||||
'tray.enable',
|
'tray.enable',
|
||||||
'common.langId',
|
'common.langId',
|
||||||
@ -124,7 +126,7 @@ const getIconPath = (id: number) => {
|
|||||||
|
|
||||||
export const createTray = () => {
|
export const createTray = () => {
|
||||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
// 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'])))
|
tray = new Tray(nativeImage.createFromPath(getIconPath(global.lx.appSetting['tray.themeId'])))
|
||||||
@ -141,6 +143,7 @@ export const destroyTray = () => {
|
|||||||
if (!tray) return
|
if (!tray) return
|
||||||
tray.destroy()
|
tray.destroy()
|
||||||
isEnableTray = false
|
isEnableTray = false
|
||||||
|
isShowStatusBar = false
|
||||||
tray = null
|
tray = null
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,9 +271,10 @@ const init = () => {
|
|||||||
themeId = global.lx.appSetting['tray.themeId']
|
themeId = global.lx.appSetting['tray.themeId']
|
||||||
setTrayImage(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']
|
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()
|
createMenu()
|
||||||
}
|
}
|
||||||
@ -338,5 +342,8 @@ export default () => {
|
|||||||
updated = true
|
updated = true
|
||||||
}
|
}
|
||||||
if (updated) init()
|
if (updated) init()
|
||||||
|
if (tray && isShowStatusBar && status.lyricLineText) {
|
||||||
|
tray.setTitle(status.lyricLineText)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,6 +53,7 @@ export const watchConfigKeys = [
|
|||||||
'desktopLyric.isAlwaysOnTop',
|
'desktopLyric.isAlwaysOnTop',
|
||||||
'desktopLyric.isAlwaysOnTopLoop',
|
'desktopLyric.isAlwaysOnTopLoop',
|
||||||
'desktopLyric.isShowTaskbar',
|
'desktopLyric.isShowTaskbar',
|
||||||
|
'desktopLyric.isShowStatusBar',
|
||||||
'desktopLyric.audioVisualization',
|
'desktopLyric.audioVisualization',
|
||||||
'desktopLyric.width',
|
'desktopLyric.width',
|
||||||
'desktopLyric.height',
|
'desktopLyric.height',
|
||||||
|
|||||||
@ -6,6 +6,7 @@ export const setting = shallowReactive<LX.DesktopLyric.Config>({
|
|||||||
'desktopLyric.isAlwaysOnTop': false,
|
'desktopLyric.isAlwaysOnTop': false,
|
||||||
'desktopLyric.isAlwaysOnTopLoop': false,
|
'desktopLyric.isAlwaysOnTopLoop': false,
|
||||||
'desktopLyric.isShowTaskbar': true,
|
'desktopLyric.isShowTaskbar': true,
|
||||||
|
'desktopLyric.isShowStatusBar': false,
|
||||||
'desktopLyric.audioVisualization': false,
|
'desktopLyric.audioVisualization': false,
|
||||||
'desktopLyric.width': 450,
|
'desktopLyric.width': 450,
|
||||||
'desktopLyric.height': 300,
|
'desktopLyric.height': 300,
|
||||||
|
|||||||
@ -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 })")
|
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
|
.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 })")
|
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
|
.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 })")
|
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
|
.gap-top
|
||||||
@ -93,7 +95,7 @@ dd
|
|||||||
<script>
|
<script>
|
||||||
import { ref, computed, onMounted, onBeforeUnmount } from '@common/utils/vueTools'
|
import { ref, computed, onMounted, onBeforeUnmount } from '@common/utils/vueTools'
|
||||||
import { getSystemFonts } from '@renderer/utils/ipc'
|
import { getSystemFonts } from '@renderer/utils/ipc'
|
||||||
import { isLinux } from '@common/utils'
|
import { isLinux, isMac } from '@common/utils'
|
||||||
import { appSetting, updateSetting } from '@renderer/store/setting'
|
import { appSetting, updateSetting } from '@renderer/store/setting'
|
||||||
import { useI18n } from '@renderer/plugins/i18n'
|
import { useI18n } from '@renderer/plugins/i18n'
|
||||||
import { pickrTools } from '@renderer/utils/pickrTools'
|
import { pickrTools } from '@renderer/utils/pickrTools'
|
||||||
@ -294,6 +296,7 @@ export default {
|
|||||||
|
|
||||||
fontList,
|
fontList,
|
||||||
isLinux,
|
isLinux,
|
||||||
|
isMac,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user