Repository navigation
fix(linux): follow Settings portal reduced-motion off the UI thread and cache fallback - #1766
Merged
Merged
Conversation
…nd cache fallback
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.
Fixes #655
Root cause
crates/rune/src/platform/preferences.rsread~/.config/kdeglobalssynchronously from disk (on KDE) and calledlibgio-2.0.so.0GSettings on the UI thread insidepreferences::reduced_motion().host_events::refresh_focus_preferencescallspreferences::reduced_motion()on every window and overlay focus change, causing synchronous filesystem I/O during input handling and permanentlydlopening GLib/GIO (with its background threads) even when the XDG Settings portal is available.Outside answer
ui/gfx/animation/animation.cc,ui/gfx/animation/animation_linux.cc,ui/gtk/gtk_ui.cc,ui/qt/qt_ui.cc,ui/linux/portal_settings_linux.cc,components/dbus/thread_linux/dbus_thread_linux.cc) cachesprefers_reduced_motion_in memory, runs D-Bus Settings portal I/O on a dedicated background thread, and updates via change signals (notify::gtk-enable-animations, Qt theme change, D-BusSettingChanged) — never reading disk or GSettings on focus changes.org.freedesktop.portal.Settings) standardizesorg.freedesktop.appearancereduced-motion(u:0no preference,1reduced motion, unknown treated as0) with liveSettingChangedsignals, served byxdg-desktop-portal-kdeandxdg-desktop-portal-gnome. GTK 4 (gdk/wayland/gdksettings-wayland.c) and Qt 6 (QXdgDesktopPortalTheme) read it once from the portal and followSettingChanged;xdg-desktop-portal-gtkand older GNOME exposeorg.gnome.desktop.interfaceenable-animations(b) on the same portal.Changes
crates/rune/src/platform/portal_appearance.rs: extend the sharedrune-appearance-portalworker and D-Bus connection to read and followorg.freedesktop.appearancereduced-motion(u32) andorg.gnome.desktop.interfaceenable-animations(bool) viaSettingChanged, storing the state in anAtomicU8and requesting window redraws on changes. When neither portal key answers, run thekdeglobals/GSettings fallback at most once on that worker thread.crates/rune/src/platform/preferences.rs: delegate Linuxreduced_motion()toportal_appearance::reduced_motion()whendbusis enabled, and cache the one-shot off-UI-thread fallback inCachedReducedMotionwhendbusis disabled.crates/rune/src/window/host/events.rs,crates/rune/src/window/host/lifecycle.rs,crates/rune/src/overlay/lifetime.rs,crates/rune/src/overlay/any_host.rs: sync the cached atomic intoRuntimeCore::set_system_reduced_motionon Linux redraw/reveal and register overlays withportal_appearance::follow.crates/rune/src/platform/portal_appearance_tests.rs,crates/rune/src/platform/preferences_tests.rs: unit tests for portal reduced-motion decoding/combination, fallback superseding,kdeglobalsparsing, and one-shot off-thread fallback caching.crates/rune/README.md,changelog/unreleased/2026-11-24-linux-portal-reduced-motion.md: document the new Linux behavior.Verification
cargo test -p rune -p rune-mermaid -p rune-kit --features rune-kit/markdown,rune-kit/mermaid platform::(122 passed).dbusand--no-default-features):cargo check -p rune -p rune-kit --testsandcargo check -p rune --no-default-features --tests.scripts/file-size.sh(0 errors).SettingChangeddelivery against a live Linux desktop portal (checked compile-only in a headless Linux container; platform-independent state logic ran in unit tests).