-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Window Position in XAML not honored on startup #3387
Comments
We found a workaround. You can't change public MyWindow()
{
...
newPosition = new(newX, newY);
}
private PixelPoint newPosition = default;
protected override void OnOpened(EventArgs e)
{
Position = newPosition;
base.OnOpened(e);
} |
@maxkatz6 Why is this not planned? Is it not possible to fix in X11 or Wayland? |
@colejohnson66 in case you know a reliable way to solve it for Avalonia, a PR is welcome. Until today, we think that not all Windowmanager support it by design and thus we cannot really solve it. |
This doesn't work on Linux Ubuntu on WSL2. On Hide then Show, the window position is restored to a random position. |
As @timunie said, not all window managers support setting the position. |
Experimenting in 0.9 and setting position of the window with something like Position="500,600" is not working on Linux but does work on Windows and Mac. At first I thought it was an out of bounds issue by setting it to 0,0, which the upper left corner of the deskop is not on my Linux (I get 1,23 for that on Mint MATE and 0,57 on Ubuntu 18.04 not counting the dock and 67,57 when not going past it). However even setting it to something close to but not the default location.
The behavior is manifesting differently on MATE and on Ubuntu 18.04 GNOME. On MATE it simply does nothing. If I capture the PositionChanged event after setting the Position to 500,500 (so no bounds problems) I can see it still draws it at 1130,570 just like if I didn't set it at all. On GNOME 3 I end up getting two position changed events. The first moves it to the requested 500,500 but then it seems to get some sort of default position from GNOME to throw it to wherever it decides to. Sometimes that's the next offset stacked window position. Sometimes it's aligned with the bottom of the terminal window I used to launch it. etc.
The text was updated successfully, but these errors were encountered: