- Apply alwaysOnTop setting on reader window init so books opened in a new window correctly inherit the setting - Update tauriHandleSetAlwaysOnTop to apply to all open windows so toggling from any window keeps all windows in sync Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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]);
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user