Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion electron/main/ipc/ipc-lyric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,12 @@ const initLyricIpc = (): void => {
}
// 绑定主窗口事件监听
bindMainWinEvents();
// 初始状态设置
if (isLocked) {
lyricWin?.setIgnoreMouseEvents(true, { forward: true });
}
} else {
lyricWin.show();
lyricWin.showInactive();
}
if (isWinAlive(lyricWin)) {
lyricWin.setAlwaysOnTop(true, "screen-saver");
Expand Down
2 changes: 1 addition & 1 deletion electron/main/windows/lyric-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class LyricWindow {
if (!this.win) return;
// 准备好显示
this.win.on("ready-to-show", () => {
this.win?.show();
this.win?.showInactive();
});
// 页面加载完成后设置标题
// 这里的标题设置是为了 Linux 能够为桌面歌词单独设置窗口规则
Expand Down
10 changes: 10 additions & 0 deletions src/composables/useInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import { useEventListener } from "@vueuse/core";
import { debounce } from "lodash-es";
import { onMounted, watch } from "vue";

/** 最终聚焦主窗口的延迟时间(毫秒) */
const FINAL_FOCUS_DELAY_MS = 500;

/**
* 应用初始化时需要执行的操作
*/
Expand Down Expand Up @@ -79,6 +82,13 @@ export const useInit = () => {
window.electron.ipcRenderer.send(TASKBAR_IPC_CHANNELS.REQUEST_DATA);
}

// 确保主窗口在最后获得焦点
if (statusStore.showDesktopLyric) {
setTimeout(() => {
window.electron.ipcRenderer.send("win-show-main");
}, FINAL_FOCUS_DELAY_MS);
}

// 监听任务栏歌词设置
watch(
() => [
Expand Down
2 changes: 1 addition & 1 deletion src/core/player/LyricManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ class LyricManager {
statusStore.lyricLoading = false;
// 单曲循环时,歌词数据未变,需通知桌面歌词取消加载状态
if (isElectron) {
window.electron.ipcRenderer.send("update-desktop-lyric-data", {
window.electron.ipcRenderer.send("desktop-lyric:update-data", {
lyricLoading: false,
});
}
Expand Down