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

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

Open
lars-berger opened this issue Jul 30, 2024 · 5 comments
Open

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

lars-berger opened this issue Jul 30, 2024 · 5 comments
Labels
platform: Windows status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@lars-berger
Copy link

lars-berger commented Jul 30, 2024

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);
  };
@lars-berger lars-berger added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jul 30, 2024
@amrbashir
Copy link
Member

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

@lars-berger
Copy link
Author

@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
Copy link

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
Copy link
Member

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
Copy link
Member

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.

amrbashir added a commit to tauri-apps/tao that referenced this issue Aug 29, 2024
* fix: return error instead of panic in `set_skip_taskbar` method

ref: tauri-apps/tauri#10422 (comment)

* change file

* Update unix.rs

* Apply suggestions from code review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Windows status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

4 participants