tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
81.83k stars 2.45k forks source link

[bug] [v2] `skipTaskbar` not working on Windows #10422

Open lars-berger opened 1 month ago

lars-berger commented 1 month ago

Describe the bug

skipTaskbar doesn't seem to be removing the window from the taskbar on Windows.

Reproduction

Reproducible via the default v2 boilerplate (i.e. pnpm create tauri-app --beta) and setting "skipTaskbar": true in the tauri.conf.json. The same occurs when instead using skip_taskbar(true) via the Builder options in Rust and skipTaskbar in the JS window APIs.

skiptaskbar

Expected behavior

For the window to not appear in the taskbar

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.19045 X64
    ✔ WebView2: 126.0.2592.113
    ✔ MSVC: Visual Studio Community 2022
    ✔ rustc: 1.76.0-nightly (5ac4c8a63 2023-12-20)
    ✔ cargo: 1.76.0-nightly (1a2666ddd 2023-12-17)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: nightly-x86_64-pc-windows-msvc (default)
    - node: 20.11.0
    - pnpm: 9.4.0
    - yarn: 1.22.19
    - npm: 8.17.0

[-] Packages
    - tauri [RUST]: 2.0.0-beta.24
    - tauri-build [RUST]: 2.0.0-beta.19
    - wry [RUST]: 0.41.0
    - tao [RUST]: 0.28.1
    - @tauri-apps/api [NPM]: 2.0.0-beta.15
    - @tauri-apps/cli [NPM]: 2.0.0-beta.22

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: SolidJS
    - bundler: Vite

Stack trace

No response

Additional context

Also tried removing the WS_EX_APPWINDOW style and adding WS_EX_TOOLWINDOW, but no luck so far 🙃

  #[cfg(target_os = "windows")]
  unsafe {
    use windows::Win32::UI::WindowsAndMessaging::*;
    let handle = window.hwnd().unwrap();
    let mut style = GetWindowLongPtrA(handle, GWL_EXSTYLE);
    style |= WS_EX_TOOLWINDOW.0 as isize;
    style &= WS_EX_APPWINDOW.0 as isize;
    SetWindowLongPtrA(handle, GWL_EXSTYLE, style);
  };
amrbashir commented 1 month ago

I can't seem to be able to reproduce this at all, could you re-test again with -rc version ?

lars-berger commented 1 month ago

@amrbashir The behavior was inconsistent - some days it worked as expected, while on others it didn't. On days where it didn't work, I tried other Tauri apps that used skipTaskbar and they also exhibited the same behavior. This occurred in our public-facing app with reports of the problem on both W10 and W11.

This is the current workaround being used to reliably remove it from the taskbar.

Rivka-Shaked commented 2 weeks ago

I tried run tauri application on windows docker, on headless, it failed on "Failed to create taskbarlist" maybe from here: image Do you have any solution to ignore this function?

amrbashir commented 2 weeks ago

This is the current workaround being used to reliably remove it from the taskbar.

Unfortunately we can't use that workaround as WS_EX_TOOLWINDOW behaves very different than normal windows and not all tauri users would appreciate it. I think this workaround shouldn't be implemented in tauri and just be used by projects that need it.

amrbashir commented 2 weeks ago

I tried run tauri application on windows docker, on headless, it failed on "Failed to create taskbarlist"

I will open a PR and release a new version to return errors here instead of panics.