voicebox icon indicating copy to clipboard operation
voicebox copied to clipboard

fix(linux): guard pill click-through against tao unrealized-window panic

Open awestwell opened this issue 5 months ago β€’ 1 comments

Problem

The app crashes on every launch on Linux with:

tao-0.34.5/src/platform_impl/linux/event_loop.rs:449:18:
called `Option::unwrap()` on a `None` value
panic in a function that cannot unwind -> abort

Root cause

The dictate pill window is built hidden at startup (visible(false)). The pill component initializes in the hidden state, so on mount it immediately emit('dictate:hide') (app/src/components/DictateWindow/DictateWindow.tsx). The Rust dictate:hide handler then calls set_ignore_cursor_events(true).

On Linux/GTK a window that has never been shown has no realized GDK window, so deep inside tao window.window() is None and .unwrap() aborts the process. macOS/Windows don't hit this because their windows realize differently.

Fix

The click-through park is a macOS NSWindow workaround anyway (per the existing comment); on Linux plain hide() + off-screen park is sufficient. Gate the set_ignore_cursor_events(true) call off on Linux.

It's the only set_ignore_cursor_events(true) call in the tree; the (false) calls take tao's safe branch and don't panic.

Testing

just dev on Pop!_OS 24.04 (Wayland, NVIDIA): app now launches cleanly and stays running, no panic, GPU detected as CUDA.

Summary by CodeRabbit

  • Bug Fixes
    • Improved window behavior when hiding dictation on Linux by avoiding a crash related to cursor-event handling.
    • Non-Linux platforms continue to use the click-through behavior as before.

awestwell avatar Jun 30 '26 18:06 awestwell

Review Change Stack

No actionable comments were generated in the recent review. πŸŽ‰

ℹ️ Recent review info
βš™οΈ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7fca8a8c-5e35-46c3-9b9f-70bd34ca45c4

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between cabef1bfe091a8e280ae5acc356869b3bcf041a8 and 94a5dc6ac33b51cc1c3b4179829bbc80c039e377.

πŸ“’ Files selected for processing (1)
  • tauri/src-tauri/src/main.rs

πŸ“ Walkthrough

Walkthrough

A #[cfg(not(target_os = "linux"))] compile-time guard was added around the set_ignore_cursor_events(true) call in the dictate:hide event handler in main.rs to prevent a runtime panic on Linux when the GDK window is not yet realized.

Changes

Linux panic fix in dictate:hide

Layer / File(s) Summary
cfg guard for cursor events
tauri/src-tauri/src/main.rs
Wraps the click-through/ignore-cursor-events logic with #[cfg(not(target_os = "linux"))] so set_ignore_cursor_events(true) is excluded from Linux builds.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

πŸ‡ On Linux the window's not ready to see, A cursor event caused a panic for me. So I wrapped it in cfg, nice and tight, Now Linux hops forward without a fright! No panic, no crash β€” what a beautiful sight. ✨

πŸš₯ Pre-merge checks | βœ… 5
βœ… Passed checks (5 passed)
Check name Status Explanation
Description Check βœ… Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check βœ… Passed The title accurately summarizes the Linux guard added to prevent the tao unrealized-window panic.
Docstring Coverage βœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check βœ… Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check βœ… Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
πŸ§ͺ Generate unit tests (beta)
  • [ ] Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot] avatar Jun 30 '26 18:06 coderabbitai[bot]

Thanks for this, @awestwell. The same fix landed on main via #906 (the set_ignore_cursor_events calls on the dictate pill are skipped on Linux with #[cfg(not(target_os = "linux"))] guards, which avoids the tao unrealized-window panic), which took the same approach, so we're closing this one as superseded. It ships in 0.6.0, now cut and waiting on an Apple notarization block.

capy-ai-staging avatar Oct 07 '26 04:10 capy-ai-staging