Skip to content

fix(tauri-cef): initialize GTK before tray creation on Linux - #8

Merged
senamakel merged 1 commit into
tinyhumansai:feat/ceffrom
VectorJet:fix/gtk-init-before-tray
Apr 23, 2026
Merged

senamakel merged 1 commit into
tinyhumansai:feat/ceffrom
VectorJet:fix/gtk-init-before-tray

Conversation

@VectorJet

Copy link
Copy Markdown

Summary

The muda crate (used by TrayIconBuilder) requires GTK to be initialized before creating the system tray. Without gtk::init() first, the app panics with:

'GTK has not been initialized. Call gtk::init first.'

This fix adds gtk::init().ok() after CEF initialization in tauri-runtime-cef/src/lib.rs, before the tray icon is created.

Changes

  • Add GTK initialization for Linux before tray creation
  • Wrapped in #[cfg(target_os = "linux")] to only apply on Linux

Testing

  • ARM Linux build succeeds
  • App launches without GTK panic on Linux

The muda crate (used by TrayIconBuilder) requires GTK to be initialized.
Without gtk::init() before creating the system tray, the app panics with:
'GTK has not been initialized. Call gtk::init first.'

This fix adds gtk::init().ok() after CEF initialization, before the tray
icon is created.
@coderabbitai

coderabbitai Bot commented Apr 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ff43025b-bdff-48e3-9732-1e2ec1eb3d2f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ 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 and usage tips.

@senamakel
senamakel merged commit ccd8632 into tinyhumansai:feat/cef Apr 23, 2026
1 check passed
@VectorJet
VectorJet deleted the fix/gtk-init-before-tray branch April 23, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants