tauri
tauri copied to clipboard
[feat] Snap layouts support on Windows when using frameless windows
Describe the problem
If I use the window decorations provided by Tauri, then I can use snap layouts.
If I set the window to "decorations": false
, the window will not be able to use snap layouts.
Describe the solution you'd like
Tauri already uses data-tauri-drag-region to support window dragging, so we might consider introducing a attribute like data-tauri-maximize-button-region to support this feature.
This should work as follows.
<div data-tauri-drag-region class="titlebar">
--- omitted ---
<div data-tauri-maximize-button-region class="titlebar-button" id="titlebar-maximize">
<img
src="https://api.iconify.design/mdi:window-maximize.svg"
alt="maximize"
/>
</div>
--- omitted ---
</div>
Alternatives considered
Platform-specific window behavior is very complex, and leaving window behavior to the user can be tricky to implement.
Electron provides BrowserWindow to handle similar issues.
Tauri can provide similar built-in components, which will also be easy to manage and optimize.
Additional context
No response
This would be something very interesting to have, it's then easier to make an app look Window's native
Are there any plans on supporting snap layouts?
Yes, or maybe "wishes" instead of "plans". Anyway, the lack of information is my bad, i only ever talked about this in other issues and on discord. So here's a tldr: The snap layout can only be openend by reacting to the NC_HITTEST message. Unfortunately these messages are not sent for clicks inside the webview. The webview2 team is working on an api proposal that should help us here though: https://github.com/MicrosoftEdge/WebView2Feedback/pull/3367 but who knows when it will be merged and actually implemented.
Waiting for webview2 to open the api I think is irrational, although there are compatibility issues with adaptation.
Yes, or maybe "wishes" instead of "plans". Anyway, the lack of information is my bad, i only ever talked about this in other issues and on discord. So here's a tldr: The snap layout can only be openend by reacting to the NC_HITTEST message. Unfortunately these messages are not sent for clicks inside the webview. The webview2 team is working on an api proposal that should help us here though: MicrosoftEdge/WebView2Feedback#3367 but who knows when it will be merged and actually implemented.
Looks like it has been merged now.
Wish it will be implemented in the standard tauri v2 :)
This won't be implemented for v2 since we're still blocked by webview2. The pr from their repo I linked above was sadly for their composition based apis only and we currently can't use those.