tao icon indicating copy to clipboard operation
tao copied to clipboard

A window with decorations can't be transparent initially until resized

Open ThisSeanZhang opened this issue 4 years ago • 2 comments

Describe the bug A clear and concise description of what the bug is. Create transparent window in win10,start app background still white, But maximize the window extra part can transparent . When resize cover the white space,Area becomes transparent.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

transparent

Platform and Versions (please complete the following information):

Operating System - Windows, version 10.0.19042 X64 Webview2 - 90.0.818.62

Node.js environment Node.js - 14.17.0 @tauri-apps/cli - 1.0.0-beta.1 @tauri-apps/api - 1.0.0-beta.1

Global packages npm - 6.14.13 yarn - 1.22.10

Rust environment rustc - 1.52.1 cargo - 1.52.0

App directory structure /.git /node_modules /public /src /src-tauri

App tauri.rs - 1.0.0-beta.1 build-type - bundle CSP - default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline' img-src: 'self' distDir - Set automatically by Vue CLI plugin devPath - Set automatically by Vue CLI plugin framework - Vue.js (Vue CLI) bundler - Webpack

Additional context Add any other context about the problem here.

Stack Trace

ThisSeanZhang avatar May 18 '21 16:05 ThisSeanZhang

I poked around and found out:

  • Transparent on electron only works when used in a frameless window, Regular windows cannot be transparent, probably they are using the same api as us.
  • We could draw to the window like glutin transparent example but with decorations on.

TBH, I am tempted to close this issue and recommend to always use transparent with decorations off but I will keep this open for now.

amrbashir avatar Aug 03 '21 19:08 amrbashir

Just found a workaround, set your decorations to false in tauri.conf, then when your app is loaded use the Javascript API to reset it to true. Worked for me

Ripwords avatar Nov 22 '21 14:11 Ripwords