Thank you both for the replies.
I'm not sure you'll find that sort of thing in the .desktop file, and my own experience is that desktop environments tend to be a bit patchy as to how well they hew to what's specified in there. I also don't think that there'll be anything in the ~/.lazarus directory since that's really for the location of files (but I'd happily be corrected).
You might possibly find that it's in your project's .lps file: this can be safely deleted but I'd suggest starting with a clean project and seeing what happened.
Apart from that you might find that your desktop environment- whatever Ubuntu provides these days (I'm a Debian user, inclined towards KDE) has some sort of per-program override setting.
Are you using Wayland or X11? Can you swap to check the other's behaviour?
MarkMLl
Okay, good to know I can (hopefully) exclude the .desktop and Lazarus's home directory.
I'm pretty sure the .lps file is not at fault. For a start, even the splash screen pops up on the wrong screen, as well as the error handling form which showed up after following Martin_fr's suggestion of trying out with an empty config folder.
But more importantly, there seems to be something fundamentally "borked" with my installation of 3.99 because since the graphics driver update, it always starts with a new project, even though "open last project at launch" is toggled. This error does not occur with my instances of Lazarus 3.4 and 2.2.6, yet they also launch onto the wrong monitor. Regardless of version, they all do this when loading a project that I know for sure I had saved on the right monitor, so the storage in the .lps shouldn't be the issue, unless Lazarus performs some operation on the parameters in there when loading the file.
I've looked into per-program overrides for launch location for Ubuntu, but couldn't find anything yet - and I'm not sure if it would apply to the FPCUpDeluxe installation of Lazarus? I'm a dilettante, but from what I can tell, it seems to be portable and self-contained, unlike a version installed through a .deb file or something like that...
I'm on X11, but I've given Wayland a quick test. The same error occurs.
However, something else happened: it did not apply my display settings from X11, and re-set the HDMI monitor as the primary display - exactly that one to which Lazarus now obsessively launches. Maybe there's an issue with my monitors and/or how Ubuntu stores my display configuration? Is there a way to basically wipe or reset that to zero, and re-register all display devices from scratch?
Normally the IDE should remember the last location of each window. It has for me on multi monitor setups under Win and Fedora.
And the code-completion drop-down should follow the source editor...
Depending on OS handling (though I only know that for Win), if your screens have different DPI settings then there can be some weirdness. (I have only seen that for hints).
I would suggest to backup your config ~/.lazarus and start with an empty one. Just to see if that helps.
if it does copy files back, until you know which one causes the issue.
- non-xml file can probably remain in the folder, but back them up anyway
- if you have packages installed your lazarus executable is in that folder too, and you want to keep it in there.
It does remember the relative positions of the windows, but the whole layout is moved to the wrong monitor. As said in my reply to MarkMLI above, even the splash screen pops up there.
I've tried starting with an empty config folder as you describe, but no luck. I just get an error handling form complaining about missing configuration files - which pops up on the wrong monitor as well.