Skip to content
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

[feat] Snap layouts support on Windows when using frameless windows #4531

Open
grislux55 opened this issue Jun 30, 2022 · 10 comments
Open

[feat] Snap layouts support on Windows when using frameless windows #4531

grislux55 opened this issue Jun 30, 2022 · 10 comments
Labels
platform: Windows status: upstream This issue is blocked by upstream dependencies and we need to wait or contribute upstream fixes type: feature request

Comments

@grislux55
Copy link

Describe the problem

Details about snap layouts

If I use the window decorations provided by Tauri, then I can use snap layouts.

snap layouts

If I set the window to "decorations": false, the window will not be able to use snap layouts.

no 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

@AZProductions
Copy link

This would be something very interesting to have, it's then easier to make an app look Window's native

@AZProductions
Copy link

AZProductions commented Jun 22, 2023

Are there any plans on supporting snap layouts?

@FabianLars
Copy link
Member

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.

@amrbashir amrbashir added the status: upstream This issue is blocked by upstream dependencies and we need to wait or contribute upstream fixes label Jun 28, 2023
@github-project-automation github-project-automation bot moved this to 📬Proposal in Roadmap Sep 26, 2023
@mchao123
Copy link

Waiting for webview2 to open the api I think is irrational, although there are compatibility issues with adaptation.

@hazre
Copy link

hazre commented Nov 6, 2023

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.

@AClon314
Copy link

Wish it will be implemented in the standard tauri v2 :)

@FabianLars
Copy link
Member

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.

@Daydreamer-riri
Copy link

‌‌Can we raise our issues to them to gain support? Is there any such action currently?

@FabianLars
Copy link
Member

‌‌Can we raise our issues to them to gain support? Is there any such action currently?

There were a few issues already, especially MicrosoftEdge/WebView2Feedback#446. There was no interest in fixing this (or adding support for it, however you wanna phrase it) in a more general way. They are working on WCO though: MicrosoftEdge/WebView2Feedback#4532 but that won't support win 7/8 if that matters.

@stevietelly
Copy link

anything new now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Windows status: upstream This issue is blocked by upstream dependencies and we need to wait or contribute upstream fixes type: feature request
Projects
Status: 📬Proposal
Development

No branches or pull requests

9 participants