diff --git a/apps/readest-app/src/app/reader/page.tsx b/apps/readest-app/src/app/reader/page.tsx index 4f7f1ffb..31cf6ece 100644 --- a/apps/readest-app/src/app/reader/page.tsx +++ b/apps/readest-app/src/app/reader/page.tsx @@ -6,6 +6,7 @@ import { useTranslation } from '@/hooks/useTranslation'; import { useOpenWithBooks } from '@/hooks/useOpenWithBooks'; import { useSettingsStore } from '@/store/settingsStore'; import { checkForAppUpdates, checkAppReleaseNotes } from '@/helpers/updater'; +import { tauriHandleSetAlwaysOnTop } from '@/utils/window'; import Reader from './components/Reader'; // This is only used for the Tauri app in the app router @@ -24,6 +25,9 @@ export default function Page() { checkAppReleaseNotes(); } }; + if (appService?.hasWindow && settings.alwaysOnTop) { + tauriHandleSetAlwaysOnTop(settings.alwaysOnTop); + } doCheckAppUpdates(); // eslint-disable-next-line react-hooks/exhaustive-deps }, [appService?.hasUpdater, settings.autoCheckUpdates]); diff --git a/apps/readest-app/src/utils/window.ts b/apps/readest-app/src/utils/window.ts index 3b3ff472..1db36714 100644 --- a/apps/readest-app/src/utils/window.ts +++ b/apps/readest-app/src/utils/window.ts @@ -1,4 +1,4 @@ -import { getCurrentWindow } from '@tauri-apps/api/window'; +import { getAllWindows, getCurrentWindow } from '@tauri-apps/api/window'; import { emitTo, TauriEvent } from '@tauri-apps/api/event'; import { exit } from '@tauri-apps/plugin-process'; import { type as osType } from '@tauri-apps/plugin-os'; @@ -76,8 +76,8 @@ export const tauriHandleToggleFullScreen = async () => { }; export const tauriHandleSetAlwaysOnTop = async (isAlwaysOnTop: boolean) => { - const currentWindow = getCurrentWindow(); - await currentWindow.setAlwaysOnTop(isAlwaysOnTop); + const windows = await getAllWindows(); + await Promise.all(windows.map((w) => w.setAlwaysOnTop(isAlwaysOnTop))); }; export const tauriGetAlwaysOnTop = async () => {