[bug] Tauri App's Close Functionality Fails After Minimize/Maximize Actions (Windows)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 111k
- Forks
- 4k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 44
Description
Describe the bug
Encountered an issue where minimizing and then attempting to close a Tauri application. Results in the close handler losing its scope. This prevents the close handler from functioning as expected.
Minimal Reproduction Example
Behavior Observed
The application is set up to intercept the WINDOW_CLOSE_REQUESTED event and prevent the default behavior, which typically closes the application. Instead, it invokes a Tauri command to hide the window. The application features a system tray implementation which allows it to remain open in the background and can be reopened with a click event on the system tray icon.
Additional Notes
This issue seems to be triggered by specific interactions with window size adjustments and the taskbar functionalities when the application is in a minimized state.
I also have not tested this on Mac and may exist there too.
Reproduction
- Run the application using
npm run tauri dev. - Right-click the application icon in the taskbar and choose "Pin to taskbar".
- Optionally, click "Close" on the application window to observe it hiding instead of closing.
- Click the Tauri icon in the system tray to display the window again. (Note: Clicking the icon pinned to the taskbar won't show the window in dev mode.)
- Simultaneously press
Win + Up ArrowandWin + Down Arrowto alternate window size. During this, right-click the pinned taskbar icon and choose "Close", while continuing to alternate window size with the arrows. - Attempt to close the application by clicking the 'X' button; observe that the application does not hide as expected, indicating a malfunction.
Expected behavior
The close handler to continue to function as a close handler
Full tauri info output
[✔] Environment
- OS: Windows 10.0.22621 X64
✔ WebView2: 123.0.2420.97
✔ MSVC:
- Visual Studio Build Tools 2017
- Visual Studio Build Tools 2022
✔ rustc: 1.77.1 (7cf61ebde 2024-03-27)
✔ cargo: 1.77.1 (e52e36006 2024-03-26)
✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
- node: 18.14.0
- npm: 9.3.1
[-] Packages
- tauri [RUST]: 1.6.1
- tauri-build [RUST]: 1.5.1
- wry [RUST]: 0.24.7
- tao [RUST]: 0.16.8
- @tauri-apps/api [NPM]: 1.5.3
- @tauri-apps/cli [NPM]: 1.5.11
[-] App
- build-type: bundle
- CSP: unset
- distDir: ../dist
- devPath: http://localhost:1420/
- framework: Vue.js
- bundler: Vite
Stack trace
No response
Additional context
https://github.com/tauri-apps/tauri/assets/3421501/20941d02-0d2c-482d-a193-3ebaa2ac019b
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked minimal reproduction repository and run it using npm run tauri dev on Windows. Follow the taskbar, tray, minimize/maximize, and close sequence described in the issue, then compare the close-handler behavior before and after those actions; done means the handler continues to function and the expected hide behavior is preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, rust
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100