Skip to content

[bug] Pressing any key in X11 results in MainEventsCleared event, even if Tauri app minimized #15239

@ReactorScram

Description

@ReactorScram

Describe the bug

Hi - I searched a bit for "x11" and "keyboard" and "MainEventsCleared" and didn't see any similar issue.

And maybe this is intentional, it allows tao to implement global keyboard shortcuts. And I know X11 is very "chatty" about input events whereas Wayland is very secure and sandboxy about them, but I'm still on xfce + x11.

But even as I'm typing this, and my Tauri app is minimized, in my terminal I see a MainEventsCleared for every single key I press. Or even keyup and keydown for the Ctrl key.

It bothers me because it means if I have 10 Tauri apps running on my x11 desktop, every keypress in any window will wake up 10 threads in 10 processes.

Is this on purpose? Can I ask Tauri / Tao not to subscribe to global keyboard events to save CPU / laptop battery?

Reproduction

Create a Tauri app using the default template, then put a tracing::info! or similar in the MainEventsCleared handler. On xfce4 + X11, every single key up and key down, even in Firefox, while the Tauri app is minimized on another workspace, results in the Tauri main thread waking up and handling a MainEventsCleared event.

Expected behavior

I expected my Tauri app to sleep when it's minimized and an unrelated app is getting key events.

I don't expect X11 to broadcast every key event to every X11 client app by default, because that would mean having 100 apps open wakes 100 threads on every keyup and keydown.

I don't expect Tao / Tauri to register to listen for global key events by default, because it uses extra CPU and battery and RAM.

Full tauri info output

(Redacted app name)

[✔] Environment
    - OS: Debian n/a x86_64 (X64) (lightdm-xsession on x11)
    ✔ webkit2gtk-4.1: 2.52.1
    ✔ rsvg2: 2.62.1
    ✔ rustc: 1.94.1 (e408947bf 2026-03-25)
    ✔ cargo: 1.94.1 (29ea6fb6a 2026-03-24)
    ✔ rustup: 1.29.0 (28d1352db 2026-03-05)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 24.14.1
    - pnpm: 8.15.0
    - npm: 11.11.0
    - deno: deno 2.5.4

[-] Packages
    - tauri 🦀: 2.10.3
    - tauri-build 🦀: 2.5.6
    - wry 🦀: 0.54.4, (outdated, latest: 0.55.0)
    - tao 🦀: 0.34.8, (outdated, latest: 0.35.0)
    - tauri-cli 🦀: 2.5.0 (outdated, latest: 2.10.1)
    - @tauri-apps/api  ⱼₛ: not installed!
    - @tauri-apps/cli  ⱼₛ: 2.10.1

[-] Plugins
    - tauri-plugin-opener 🦀: 2.5.3
    - @tauri-apps/plugin-opener  ⱼₛ: not installed!

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: React
    - bundler: Vite

Stack trace

No stack trace, app is not crashing

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions