Skip to content

Commit 2bb4d65

Browse files
Merge pull request #918 from laoshuikaixue/feature/taskbar-lyric-word
feat(taskbar): 添加任务栏逐字歌词功能
2 parents ae4951e + 9c71f1b commit 2bb4d65

26 files changed

Lines changed: 137 additions & 91 deletions

File tree

electron/main/ipc/ipc-taskbar.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const getTaskbarConfig = (): TaskbarConfig => {
2727
singleLineMode: store.get("taskbar.singleLineMode", false),
2828
showTranslation: store.get("taskbar.showTranslation", true),
2929
showRomaji: store.get("taskbar.showRomaji", true),
30+
showWordLyrics: store.get("taskbar.showWordLyrics", true),
3031
};
3132
};
3233

src/assets/data/lyricConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const config: LyricConfig = {
99
fontSize: 24,
1010
fontWeight: 400,
1111
showTran: true,
12-
showYrc: true,
12+
showWordLyrics: true,
1313
isDoubleLine: true,
1414
position: "both",
1515
limitBounds: false,

src/components/AMLL/LyricPlayer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ watch(
308308
player.scrollToIndex = Math.min(...player.bufferedLines);
309309
} else {
310310
const foundIndex = player.processedLines.findIndex(
311-
(line: any) => line.startTime >= time
311+
(line: any) => line.startTime >= time,
312312
);
313313
player.scrollToIndex = foundIndex === -1 ? player.processedLines.length : foundIndex;
314314
}
@@ -321,7 +321,7 @@ watch(
321321
playerRef.value?.setCurrentTime(time, false);
322322
}
323323
},
324-
{ immediate: true }
324+
{ immediate: true },
325325
);
326326
327327
// 渐变宽度

src/components/Menu/CoverMenu.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,7 @@ const openDropdown = async (
100100
label: `分享${type === "playlist" ? "歌单" : type === "album" ? "专辑" : type === "video" ? "视频" : "电台"}链接`,
101101
show: item.id !== 0 && item.id?.toString().length < 16,
102102
props: {
103-
onClick: () =>
104-
copyData(
105-
getShareUrl(type, item.id),
106-
"已复制分享链接到剪贴板",
107-
),
103+
onClick: () => copyData(getShareUrl(type, item.id), "已复制分享链接到剪贴板"),
108104
},
109105
icon: renderIcon("Share", { size: 18 }),
110106
},

src/components/Player/FullPlayer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ const isShowComment = computed<boolean>(
118118
/** 没有歌词 */
119119
const noLrc = computed<boolean>(() => {
120120
const noNormalLrc = !musicStore.isHasLrc;
121-
const noYrcAvailable = !musicStore.isHasYrc || !settingStore.showYrc;
121+
const noYrcAvailable = !musicStore.isHasYrc || !settingStore.showWordLyrics;
122122
return noNormalLrc && noYrcAvailable;
123123
});
124124
@@ -161,7 +161,7 @@ const playerDataCenter = computed<boolean>(
161161
162162
// 当前实时歌词
163163
const instantLyrics = computed(() => {
164-
const isYrc = musicStore.songLyric.yrcData?.length && settingStore.showYrc;
164+
const isYrc = musicStore.songLyric.yrcData?.length && settingStore.showWordLyrics;
165165
const content = isYrc
166166
? musicStore.songLyric.yrcData[statusStore.lyricIndex]
167167
: musicStore.songLyric.lrcData[statusStore.lyricIndex];

src/components/Player/MainPlayer.vue

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,7 @@ const songMoreOptions = computed<DropdownOption[]>(() => {
325325
label: `分享${song.type === "song" ? "歌曲" : "节目"}链接`,
326326
show: !isLocal,
327327
props: {
328-
onClick: () =>
329-
copyData(
330-
getShareUrl(song.type, song.id),
331-
"已复制分享链接到剪切板",
332-
),
328+
onClick: () => copyData(getShareUrl(song.type, song.id), "已复制分享链接到剪切板"),
333329
},
334330
icon: renderIcon("Share", { size: 18 }),
335331
},
@@ -414,7 +410,7 @@ const isShowLyrics = computed(() => {
414410
415411
// 当前实时歌词
416412
const instantLyrics = computed(() => {
417-
const isYrc = musicStore.songLyric.yrcData?.length && settingStore.showYrc;
413+
const isYrc = musicStore.songLyric.yrcData?.length && settingStore.showWordLyrics;
418414
const content = isYrc
419415
? musicStore.songLyric.yrcData[statusStore.lyricIndex]
420416
: musicStore.songLyric.lrcData[statusStore.lyricIndex];

src/components/Player/PlayerControl.vue

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -182,38 +182,38 @@ watch(
182182
);
183183
184184
watch(
185-
() => statusStore.automixEndedSeq,
186-
(seq, prev) => {
187-
if (!seq || seq === prev) return;
188-
if (showAutomixLabel.value) {
189-
if (automixFxTimer !== null) {
190-
window.clearTimeout(automixFxTimer);
191-
}
192-
automixFxTimer = window.setTimeout(() => {
193-
showAutomixLabel.value = false;
194-
showAutomixFx.value = false;
195-
automixFxTimer = null;
196-
}, 2000); // 混音结束后保留 2 秒再淡出
185+
() => statusStore.automixEndedSeq,
186+
(seq, prev) => {
187+
if (!seq || seq === prev) return;
188+
if (showAutomixLabel.value) {
189+
if (automixFxTimer !== null) {
190+
window.clearTimeout(automixFxTimer);
197191
}
198-
},
199-
);
192+
automixFxTimer = window.setTimeout(() => {
193+
showAutomixLabel.value = false;
194+
showAutomixFx.value = false;
195+
automixFxTimer = null;
196+
}, 2000); // 混音结束后保留 2 秒再淡出
197+
}
198+
},
199+
);
200200
201-
// 监听歌曲变化,延迟关闭混音显示和辉光
202-
watch(
203-
() => musicStore.playSong?.id,
204-
(_newId, _oldId) => {
205-
if (showAutomixLabel.value) {
206-
if (automixFxTimer !== null) {
207-
window.clearTimeout(automixFxTimer);
208-
}
209-
automixFxTimer = window.setTimeout(() => {
210-
showAutomixLabel.value = false;
211-
showAutomixFx.value = false;
212-
automixFxTimer = null;
213-
}, 2000); // 切歌后保留 2 秒再淡出
201+
// 监听歌曲变化,延迟关闭混音显示和辉光
202+
watch(
203+
() => musicStore.playSong?.id,
204+
(_newId, _oldId) => {
205+
if (showAutomixLabel.value) {
206+
if (automixFxTimer !== null) {
207+
window.clearTimeout(automixFxTimer);
214208
}
215-
},
216-
);
209+
automixFxTimer = window.setTimeout(() => {
210+
showAutomixLabel.value = false;
211+
showAutomixFx.value = false;
212+
automixFxTimer = null;
213+
}, 2000); // 切歌后保留 2 秒再淡出
214+
}
215+
},
216+
);
217217
218218
const onFxAnimationEnd = () => {
219219
// 移除之前的单次动画结束逻辑,因为现在是 infinite 循环,直到 showAutomixFx 为 false

src/components/Player/PlayerLyric/AMLyric.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const amLyricsData = computed(() => {
8282
const { songLyric } = musicStore;
8383
if (!songLyric) return [];
8484
// 优先使用逐字歌词(YRC/TTML)
85-
const useYrc = songLyric.yrcData?.length && settingStore.showYrc;
85+
const useYrc = songLyric.yrcData?.length && settingStore.showWordLyrics;
8686
const lyrics = useYrc ? songLyric.yrcData : songLyric.lrcData;
8787
// 简单检查歌词有效性
8888
if (!Array.isArray(lyrics) || lyrics.length === 0) return [];

src/components/Player/PlayerLyric/DefaultLyric.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ const player = usePlayerController();
156156
const lyricScrollContainer = ref<HTMLElement | null>(null);
157157
158158
// 是否为逐字歌词模式
159-
const isYrcMode = computed(() => settingStore.showYrc && musicStore.isHasYrc);
159+
const isYrcMode = computed(() => settingStore.showWordLyrics && musicStore.isHasYrc);
160160
161161
// 获取当前使用的歌词数据
162162
const currentLyricData = computed(() => {

src/components/Player/PlayerMeta/PlayerData.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ const player = usePlayerController();
168168
169169
// 当前歌词模式
170170
const lyricMode = computed(() => {
171-
if (settingStore.showYrc) {
171+
if (settingStore.showWordLyrics) {
172172
if (statusStore.usingTTMLLyric) return "TTML";
173173
if (musicStore.isHasYrc) {
174174
// 如果是从QQ音乐获取的歌词,显示QRC

0 commit comments

Comments
 (0)