feat(desktop): make libxdo opt-in on Linux via linux-libxdo - #5749
Merged
Conversation
`libxdo` is a default feature of both `muda` and `tray-icon`, so every Dioxus desktop app links `libxdo.so` whether or not it uses menus. muda documents the feature as existing solely to make the predefined Copy, Cut, Paste and SelectAll menu items work on Linux. Because the soname is recorded at link time, a binary built on Ubuntu (libxdo.so.3) will not start on a distro shipping libxdo 4, even with xdotool installed. That makes prebuilt Linux artifacts non-portable for a library most apps never call. Disables default features on both crates, keeps `gtk` (which is what renders menus and tray icons on Linux), and adds an opt-in `linux-libxdo` feature for apps that do use the predefined items. Mirrors tauri's `linux-libxdo`, which resolves this the same way. Verified: libxdo is absent from the dependency graph by default and restored by `--features linux-libxdo`.
nabbisen
added a commit
to forskscope/forskscope
that referenced
this pull request
Aug 11, 2026
DioxusLabs/dioxus#5749 merged 2026-08-10 (b6c258b): muda and tray-icon now take default-features = false with gtk kept, and libxdo is opt-in behind linux-libxdo, mirroring Tauri. Not yet released, so F44 stays open and 0.166.1 is gated on a dioxus-desktop release. We already pass default-features = false, so the fix arrives with a version bump alone.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
libxdois a default feature of bothmudaandtray-icon, sodioxus-desktoplinkslibxdo.sointo every Linux desktop app. muda documents the feature's entire purpose:An app that never uses those items — including any app that calls
.with_menu(None)— still hard-links the library.That is normally just an extra build prerequisite, which is how it usually gets reported (#5090, #2219). The sharper consequence is at distribution time, and I haven't found it written down anywhere:
The soname is recorded at link time, so a release binary built on
ubuntu-latestrecordslibxdo.so.3. Ubuntu ships soname 3; Arch and other rolling distros ship 4. The dynamic loader will not substitute one for the other, so:Installing
xdotooldoes not fix this — the user already haslibxdo.so.4. There is no supported way to get soname 3 on those distros, so a prebuilt Linux artifact simply cannot run there, over a library the app never calls.I hit this shipping a Dioxus app: of the binary's 146 dynamic dependencies, exactly one was unresolvable. GTK 3 and WebKitGTK 4.1 record identical sonames on both distro families and are fine;
libxdois the only one that skews.Change
Mirrors what Tauri already does —
tauri/Cargo.tomldeclaresmudaandtray-iconwithdefault-features = falseand exposeslinux-libxdoas opt-in, since v2.0.0-alpha.11. Same crates, same maintainers, same reasoning.mudaandtray-iconare declared withdefault-features = falsegtkis kept explicitly on both — that is what actually renders menus and tray icons on Linuxlinux-libxdofeature restores the old behaviour for apps that use the predefined menu itemsVerification
In this branch's own workspace:
I also applied the equivalent change to
dioxus-desktop0.7.9 via[patch.crates-io]and rebuilt a real application against it:readelf -dshows nolibxdoentry, where the unpatched build recordedlibxdo.so.3libxdo-sysleaves the dependency graph entirelylibxdo.so.3presentNotes
This is a breaking change only for apps that rely on the predefined
Copy/Cut/Paste/SelectAllmenu items on Linux; they needfeatures = ["linux-libxdo"]. Apps already passingdefault-features = falsetodioxus-desktoppick up the fix with no change. Happy to add a CHANGELOG entry or adjust the feature name if you'd prefer it match something else.