-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Describe the bug
When the main window is created with "visible": false (to avoid a white flash or to show a splash/updater window first),
calling .requestUserAttention(UserAttentionType.Informational) later does nothing.
It seems that if "focus": true is set in the window config for ANY of the windows (which is the default),
the app process is treated as already focused, even though the actual window is invisible and not focused, so the attention request likely gets cancelled internally.
Calling setFocus() doesn’t help, because unlike "focus": true in the window config,
it forces focus even if another app is active, which is undesirable UX.
As a result, there’s currently no way to implement the common pattern:
- If the user launched the app, focus the main window
- If the user switched to another app, just flash in the taskbar.
It's especially common when using a splash/updater window before showing the main app window.
Reproduction
tauri.conf.json
{
"windows": [
{ "label": "main", "visible": false },
{ "label": "splash", "visible": true }
]
}splash.tsx
import { WebviewWindow, getCurrentWindow } from '@tauri-apps/api/window';
import { useEffect } from 'react';
export function Splash() {
useEffect(() => {
(async () => {
const main = await WebviewWindow.getByLabel('main');
await main.show();
await main.requestUserAttention(2); // does nothing
await getCurrentWindow().close();
})();
}, []);
return <div>Splash</div>;
}- Run the app.
- Alt-Tab and do smth in another window before the splash closes.
Expected behavior
- If it does, prevent
"focus": truefrom marking the app process treated as focused even when the windows are invisible. - Or, make
requestUserAttention()still work even if an invisible window with"focus": trueexists. - Alternatively, introduce an API or a flag on
.setFocus()that will behave likefocus: truein window config, respecting the current user focus (and it can even optionally flash the taskbar). - Or, consider having
.show()automatically request attention if the app isn’t foregrounded.
Full tauri info output
[✔] Environment
- OS: Windows 10.0.26200 x86_64 (X64)
✔ WebView2: 141.0.3537.71
✔ MSVC: Visual Studio Community 2022
✔ rustc: 1.90.0 (1159e78c4 2025-09-14)
✔ cargo: 1.90.0 (840b83a10 2025-07-30)
✔ rustup: 1.28.2 (e4f3ad6f8 2025-04-28)
✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
- node: 22.20.0
- pnpm: 10.17.1
- npm: 10.9.3
[-] Packages
- tauri 🦀: 2.8.5
- tauri-build 🦀: 2.4.1
- wry 🦀: 0.53.3, (outdated, latest: 0.53.4)
- tao 🦀: 0.34.3, (outdated, latest: 0.34.4)
- @tauri-apps/api : 2.8.0
- @tauri-apps/cli : 2.8.4
[-] Plugins
- tauri-plugin-global-shortcut 🦀: 2.3.0
- @tauri-apps/plugin-global-shortcut : 2.3.0
- tauri-plugin-dialog 🦀: 2.4.0
- @tauri-apps/plugin-dialog : 2.4.0
- tauri-plugin-deep-link 🦀: 2.4.3
- @tauri-apps/plugin-deep-link : 2.4.3
- tauri-plugin-updater 🦀: 2.9.0
- @tauri-apps/plugin-updater : 2.9.0
- tauri-plugin-store 🦀: 2.4.0
- @tauri-apps/plugin-store : 2.4.0
- tauri-plugin-process 🦀: 2.3.0
- @tauri-apps/plugin-process : 2.3.0
- tauri-plugin-opener 🦀: 2.5.0
- @tauri-apps/plugin-opener : 2.5.0
- tauri-plugin-single-instance 🦀: 2.3.4
- @tauri-apps/plugin-single-instance : not installed!
- tauri-plugin-positioner 🦀: 2.3.0
- @tauri-apps/plugin-positioner : 2.3.0
- tauri-plugin-fs 🦀: 2.4.2
- @tauri-apps/plugin-fs : not installed!
[-] App
- build-type: bundle
- CSP: ...
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- framework: React
- bundler: Vite
Stack trace
Additional context
No response