tao icon indicating copy to clipboard operation
tao copied to clipboard

window vibrancy feature

Open samirdjelal opened this issue 3 years ago • 7 comments

it will be great to see window vibrancy feature in Tauri Here is some examples that made in electron

https://github.com/arkenthera/electron-vibrancy https://github.com/Seo-Rii/electron-acrylic-window/blob/master/src/native/win10.cpp

image image

samirdjelal avatar Jul 19 '21 14:07 samirdjelal

For macOS it should be quite easy; https://developer.apple.com/documentation/appkit/nsvisualeffectview?language=objc

lemarier avatar Jul 19 '21 14:07 lemarier

On Linux, transparency/blur is usually used by the user compositor and we can't control that, however I think I've seen some apps before that use clever tricks to workaround this (I need to do more research). There is also some news about gtk4 has some blur effect but since I haven't tried it at all, it might not be the expected behavior. IMO I don't think we should support Linux for this, too much work and users can easily configure their compositer.

On Windows:

  • win7 supports blur only (DWMEnableBlurBehind).
  • win8 doesn't support any blur method, not to my knowledge at least.
  • win10 supports blur on all versions I think without any problems. It also supports acrylic but only on win10 v1809+ and it will have lags when resizing/moving the window (SetWindowCompositionAttribute).
  • win11 is the same as win10 but also supports mica (DwmSetWindowAttribute).

amrbashir avatar Jul 19 '21 15:07 amrbashir

I'm going to upgrade to gtk4 and see how it goes? If that works well, maybe we could add this later.

wusyong avatar Jul 21 '21 02:07 wusyong

Note that Windows 11 also has undocumented APIs for enabling the new Mica blur effects as well.

Tropix126 avatar Oct 24 '21 18:10 Tropix126

@Tropix126 is it SetWindowCompositionAttribute or something else ?

Edit: According to this comment, seems like there is a new variant in dwmapi.h that can be used with DwmSetWindowAttribute but it is still in preview sdk and not stable.

amrbashir avatar Oct 24 '21 20:10 amrbashir

for anyone interested in this issue, I made a https://github.com/tauri-apps/window-vibrancy to experiment with the feature. it supports tao and tauri and I'd appreciate feedback on different Windows versions, macOS support will be added later.

Edit: macOS is now supported.

amrbashir avatar Dec 06 '21 13:12 amrbashir

The lastest insider build of Windows 11 (22523) just got public facing Win32 APIs for Mica and Acrylic composition effects respectively under DWMWA_SYSTEMBACKDROP_TYPE: https://twitter.com/StartIsBack/status/1471262840313065474/

Tropix126 avatar Dec 17 '21 00:12 Tropix126

Closing this as https://github.com/tauri-apps/window-vibrancy is enough and will try to include it in tauri@v2 by default.

amrbashir avatar Jan 09 '23 22:01 amrbashir

Closing this as https://github.com/tauri-apps/window-vibrancy is enough and will try to include it in tauri@v2 by default.

Hopefully with Linux support?

developomp avatar Jan 10 '23 02:01 developomp

Hopefully with Linux support?

To our knowledge the note in the readme is still accurate, at least if we don't want to force users to install gnome extensions. We'd love to be proven wrong about that though, so if you know something we don't, please reach out to us!

FabianLars avatar Jan 10 '23 09:01 FabianLars