wails icon indicating copy to clipboard operation
wails copied to clipboard

Would like to have control over window location...

Open precisionpete opened this issue 2 years ago • 4 comments
trafficstars

Is your feature request related to a problem? Please describe.

It would be nice to have control over where the window opens.

e.g. The first time it opens, it opens in the center of the screen. After hiding and showing it, it opens near the top left (under Linux at least). I would like to be able to pin it to the bottom right - like Microsoft OneDrive. I am using a port of lantern systray to create a panel icon to control the show/hide of the window. Works great. I would like to be able to have the window show near the icon.

e.g. model behavior after MS OneDrive on Windows.

Describe the solution you'd like

Prefer control over properties that will be remembered between show/hide.

I don't need pixel control. Aligning center, top-left, bottom-left, etc would be enough. Maybe if the user moves it, it will remember the location. Or have the ability to lock it somewhere.

It would have to be different or computable based on some criteria. e.g. Windows = bottom left, Mac = top right, Linux needs somehow to figure that out from the environment. Cinnamon, vs PopOS, etc.

Describe alternatives you've considered

No response

Additional context

No response

precisionpete avatar Oct 16 '23 18:10 precisionpete

There is code to do this in the v3 alpha branch if you're happy to backport.

We also have native support for systray in v3 and the window alignment happens automatically when you associate a window with a systray. There's no release date yet so backporting may be the best option.

leaanthony avatar Oct 16 '23 20:10 leaanthony

Interesting.

How would I backport? fork it and snake the changes on my copy?

Peter Carroll @.*** https://bluefriday.ca

On Mon, Oct 16, 2023 at 4:04 PM Lea Anthony @.***> wrote:

There is code to do this in the v3 alpha branch if you're happy to backport.

We also have native support for systray in v3 and the window alignment happens automatically when you associate a window with a systray. There's no release date yet so backporting may be the best option.

— Reply to this email directly, view it on GitHub https://github.com/wailsapp/wails/issues/2988#issuecomment-1765187389, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSEIE4E64UQHOCXD3QJMC3X7WHLXAVCNFSM6AAAAAA6CTWVCSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRVGE4DOMZYHE . You are receiving this because you authored the thread.Message ID: @.***>

precisionpete avatar Oct 16 '23 20:10 precisionpete

Interesting. How would I backport? fork it and snake the changes on my copy?

Correct, submit a new PR with the changes in V2 in your fork, to have the changes considered and merged. https://wails.io/community-guide#ways-of-contributing

PylotLight avatar Oct 17 '23 00:10 PylotLight

我的解决方案是 默认隐藏的,在前端入口出重新设置位置: const x = (screen.width - 应用width) * window.devicePixelRatio - 16 const y = (screen.height - 应用高度) * window.devicePixelRatio - 76 window.runtime.WindowSetPosition(x, y)

Mluocheng avatar Jan 11 '24 10:01 Mluocheng