But this ends up happening: https://github.com/SlimeVR/SlimeVR-Server/issues/433
#Tauri remembers where the window was
66 messages ยท Page 1 of 1 (latest)
are you use the latest tauri-plugin-window-state?
I am looked the code, it's restore position only when the saved monitor name is exists.
oh, the fix is not released yet, you could use it by directly specify the repo.
like replace original dep by this:
tauri-plugin-window-state = { git = "https://github.com/tauri-apps/tauri-plugin-window-state.git" }
yeah will do :p
i will override the dependency probably
Ok it still happens
@fathom sonnet so if you remove the main display and your second display becomes the main one it still happens
im checking what i can do, i have already some logs
remembered state: Some(WindowMetadata { width: 800.0, height: 600.0, x: -888, y: 234, maximized: false, visible: true, decorated: true, fullscreen: false, monitor: "\\\\.\\DISPLAY2" })
original available monitors: Map { iter: Iter([Monitor { name: Some("\\\\.\\DISPLAY1"), size: PhysicalSize { width: 1920, height: 1080 }, position: PhysicalPosition { x: 0, y: 0 }, scale_factor: 1.0 }, Monitor { name: Some("\\\\.\\DISPLAY2"), size: PhysicalSize { width: 1080, height: 1920 }, position: PhysicalPosition { x: -1080, y: -408 }, scale_factor: 1.0 }]) } is \\.\DISPLAY2
me after removing the main monitor: Map { iter: Iter([Monitor { name: Some("\\\\.\\DISPLAY2"), size: PhysicalSize { width: 1920, height: 1080 }, position: PhysicalPosition { x: 0, y: 0 }, scale_factor: 1.0 }]) } is \\.\DISPLAY2
umm. maybe because it only check monitor name, not checking monitor size
yeah
we might need to save all the information of the original monitor because the name is not enough :c
but in the logs, it shouldn't happen because size and scale_factor are all same between two monitors
size isnt the same in my case
but it still would happen with same size
because position changes
umm, I think I understand it.
yeah
its not that complicated of an issue
i will modify the code and make a PR then
gotta add a new struct about each monitor sadly
might make it a new field so it doesnt break semver
or idk
let me see xd
I think you could check the saved position is or not in the monitor
I think no
https://github.com/tauri-apps/tauri-plugin-window-state/blob/dev/src/lib.rs#L105-L115
just add a position check into this
I think res check is covered in the position check
hm
yeah you might be right
unless we are talking about the main monitor
because its position is always 0 0
the other monitors will change position when they have a res change
for m in self.available_monitors()? {
if m.name().map(ToString::to_string).unwrap_or_default() != state.monitor {
continue;
}
// psudocodes
if state.x < m.position.x || state.y < m.position.y || state.x > m.position.x + m.size.width || state.x > m.position.y + m.size.height {
continue;
}
// end psudocode
self.set_position(PhysicalPosition {
x: state.x,
y: state.y,
})?;
break;
}
like this
maybe need to subtract some width and height base on window size
otherwise it could be something like this:
or
if state.x < m.position.x || state.y < m.position.y || state.x + state.width > m.position.x + m.size.width || state.y + state.height > m.position.y + m.size.height {
continue;
}
it should break instead of continuing the loop
because it already found the monitor
but yeah i catch the idea
continue because those is check "is not the original name" and check "is outside monitor space"
^ Please make sure to report the issue and/or make PRs on https://github.com/tauri-apps/plugins-workspace ๐
@knotty vapor if you can pls archive the other repo
and edit the readme linking to the new repo
:p
i was gonna make the PR when i have time
@vagrant lily wdyt?
I wish I could but I need someone else to fix repo permissions first #archive-dev-plugins message
btw pr redone on the new repo ;)
Having a look at it
(https://github.com/tauri-apps/plugins-workspace/pull/48)
It took a different approach though, would be great if you can test and let us know if that fixes your issue @torn berry
If it doesn't you can open an issue on the repo there, make a bugreport :]