diff --git a/publish/changeLog.md b/publish/changeLog.md index 53144574..ac2286c3 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -5,6 +5,7 @@ - 新增播放详情页歌词右键菜单,原来设置-播放详情页设置的字体重置已迁移到此菜单内 - 新增歌词偏移设置,可以在播放详情页歌词右键菜单中使用 - 新增设置-播放设置-播放错误时自动切换歌曲设置,默认开启(原来的行为),若你不想在遇到音频加载失败、url获取失败等错误时自动切歌可以关闭此设置 +- 新增设置-桌面歌词设置-自动刷新歌词置顶(当歌词置顶后仍被某些程序遮挡时可尝试启用此设置) ### 优化 diff --git a/src/common/defaultSetting.js b/src/common/defaultSetting.js index 15d75e44..6903b578 100644 --- a/src/common/defaultSetting.js +++ b/src/common/defaultSetting.js @@ -2,7 +2,7 @@ const path = require('path') const os = require('os') const defaultSetting = { - version: '1.0.55', + version: '1.0.56', player: { togglePlayMethod: 'listLoop', highQuality: false, @@ -32,6 +32,7 @@ const defaultSetting = { enable: false, isLock: false, isAlwaysOnTop: false, + isAlwaysOnTopLoop: false, width: 380, height: 420, x: null, diff --git a/src/lang/en-us.json b/src/lang/en-us.json index 1504e9a7..4a44cca0 100644 --- a/src/lang/en-us.json +++ b/src/lang/en-us.json @@ -257,6 +257,7 @@ "setting__click_open": "Click to open", "setting__desktop_lyric": "Desktop Lyric Settings", "setting__desktop_lyric_always_on_top": "Make the lyrics always above other windows", + "setting__desktop_lyric_always_on_top_loop": "Automatically refresh the top of the lyrics (try to enable this setting when the lyrics are still blocked by some programs)", "setting__desktop_lyric_delay_scroll": "Delayed lyrics scroll", "setting__desktop_lyric_enable": "Display lyrics", "setting__desktop_lyric_font": "Lyric font", diff --git a/src/lang/zh-cn.json b/src/lang/zh-cn.json index 18f3d0b0..26fe4b7b 100644 --- a/src/lang/zh-cn.json +++ b/src/lang/zh-cn.json @@ -257,6 +257,7 @@ "setting__click_open": "点击打开", "setting__desktop_lyric": "桌面歌词设置", "setting__desktop_lyric_always_on_top": "使歌词总是在其他窗口之上", + "setting__desktop_lyric_always_on_top_loop": "自动刷新歌词置顶(当歌词置顶后仍被某些程序遮挡时可尝试启用此设置)", "setting__desktop_lyric_delay_scroll": "延迟歌词滚动", "setting__desktop_lyric_enable": "显示歌词", "setting__desktop_lyric_font": "歌词字体", diff --git a/src/lang/zh-tw.json b/src/lang/zh-tw.json index 14e889c1..68a459de 100644 --- a/src/lang/zh-tw.json +++ b/src/lang/zh-tw.json @@ -257,6 +257,7 @@ "setting__click_open": "點擊打開", "setting__desktop_lyric": "桌面歌詞設置", "setting__desktop_lyric_always_on_top": "使歌詞總是在其他窗口之上", + "setting__desktop_lyric_always_on_top_loop": "自動刷新歌詞置頂(當歌詞置頂後仍被某些程序遮擋時可嘗試啟用此設置)", "setting__desktop_lyric_delay_scroll": "延遲歌詞滾動", "setting__desktop_lyric_enable": "顯示歌詞", "setting__desktop_lyric_font": "歌詞字體", diff --git a/src/main/modules/winLyric/event.js b/src/main/modules/winLyric/event.js index 785d2077..188f6ba8 100644 --- a/src/main/modules/winLyric/event.js +++ b/src/main/modules/winLyric/event.js @@ -6,7 +6,34 @@ const { getLyricWindowBounds } = require('./utils') let isLock = null let isEnable = null let isAlwaysOnTop = null +let isAlwaysOnTopLoop = null let isLockScreen = null + +const alwaysOnTopTools = { + timeout: null, + alwaysOnTop: false, + setAlwaysOnTop(flag, isLoop) { + this.alwaysOnTop = flag + this.clearLoop() + global.modules.lyricWindow.setAlwaysOnTop(flag, 'screen-saver') + console.log(isLoop) + if (flag && isLoop) this.startLoop() + }, + startLoop() { + if (!this.alwaysOnTop) return + this.timeout = setInterval(() => { + if (!global.modules.lyricWindow) return this.clearLoop() + global.modules.lyricWindow.setAlwaysOnTop(true, 'screen-saver') + }, 1000) + }, + clearLoop() { + if (!this.timeout) return + clearInterval(this.timeout) + this.timeout = null + }, +} + + const setLrcConfig = () => { let desktopLyric = global.appSetting.desktopLyric if (global.modules.lyricWindow) { @@ -26,7 +53,15 @@ const setLrcConfig = () => { } if (isAlwaysOnTop != desktopLyric.isAlwaysOnTop) { isAlwaysOnTop = desktopLyric.isAlwaysOnTop - global.modules.lyricWindow.setAlwaysOnTop(desktopLyric.isAlwaysOnTop, 'screen-saver') + alwaysOnTopTools.setAlwaysOnTop(desktopLyric.isAlwaysOnTop, desktopLyric.isAlwaysOnTopLoop) + } + if (isAlwaysOnTopLoop != desktopLyric.isAlwaysOnTopLoop) { + isAlwaysOnTopLoop = desktopLyric.isAlwaysOnTopLoop + if (isAlwaysOnTopLoop) { + alwaysOnTopTools.startLoop() + } else { + alwaysOnTopTools.clearLoop() + } } if (isLockScreen != desktopLyric.isLockScreen) { isLockScreen = desktopLyric.isLockScreen @@ -45,6 +80,7 @@ const setLrcConfig = () => { if (desktopLyric.enable) { global.lx_event.winLyric.create() } else { + alwaysOnTopTools.clearLoop() global.lx_event.winLyric.close() } } diff --git a/src/renderer/views/setting/components/SettingDesktopLyric.vue b/src/renderer/views/setting/components/SettingDesktopLyric.vue index b8296385..a78e329c 100644 --- a/src/renderer/views/setting/components/SettingDesktopLyric.vue +++ b/src/renderer/views/setting/components/SettingDesktopLyric.vue @@ -9,6 +9,8 @@ dd base-checkbox(id="setting_desktop_lyric_delayScroll" v-model="currentStting.desktopLyric.isDelayScroll" :label="$t('setting__desktop_lyric_delay_scroll')") .gap-top base-checkbox(id="setting_desktop_lyric_alwaysOnTop" v-model="currentStting.desktopLyric.isAlwaysOnTop" :label="$t('setting__desktop_lyric_always_on_top')") + .gap-top + base-checkbox(id="setting_desktop_lyric_alwaysOnTopLoop" v-model="currentStting.desktopLyric.isAlwaysOnTopLoop" :label="$t('setting__desktop_lyric_always_on_top_loop')") .gap-top base-checkbox(id="setting_desktop_lyric_lockScreen" v-model="currentStting.desktopLyric.isLockScreen" :label="$t('setting__desktop_lyric_lock_screen')") dd