try availableMonitors if currentMonitor isn’t

This commit is contained in:
FTCHD
2025-08-05 05:13:53 +03:00
parent 1bec1378f2
commit db89d3a103
+14 -2
View File
@@ -1,5 +1,11 @@
import { WebviewWindow } from '@tauri-apps/api/webviewWindow'
import { LogicalSize, PhysicalSize, currentMonitor, getAllWindows } from '@tauri-apps/api/window'
import {
LogicalSize,
PhysicalSize,
availableMonitors,
currentMonitor,
getAllWindows,
} from '@tauri-apps/api/window'
import { platform } from '@tauri-apps/plugin-os'
import { useStore } from './store'
import { getLoadingTray, getMainTray } from './tray'
@@ -36,7 +42,13 @@ export async function openFullWindow({
url: url,
})
const size = await currentMonitor().then((m) => m?.size)
let monitor = await currentMonitor()
if (!monitor) {
monitor = (await availableMonitors())[0]
}
const size = monitor?.size
if (!size) {
console.error('[openFullWindow] no monitor found')