You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Linux: the reduced-motion preference is read from disk on the UI thread on every focus change #655
On KDE, every call opens, reads and closes ~/.config/kdeglobals synchronously on the UI thread,
uncached, and then falls through to a GLib schema lookup and g_settings_get_boolean.
It is called from:
crates/rune/src/window/events.rs:354 — the WindowEvent::Focused handler (every focus change);
crates/rune/src/window.rs:540 — window setup;
crates/rune/src/overlay.rs:391 and crates/rune/src/overlay/any_host.rs:129 — both overlay hosts, on focus.
This breaks the rule AGENTS.md states for this repo:
No file I/O in the frame loop: never read, stat, write, sync or rename a file on the UI thread
during frames, input or animation. On Windows each open and MoveFileExW rename runs antivirus
filter callbacks and can fail with a sharing violation.
A focus change is input handling. On a network home directory (~/.config on NFS or a redirected
profile) the read can stall the UI thread for hundreds of milliseconds, right when the user clicks
into the window.
The macOS and Windows branches use native APIs and are cheap; only the Linux/KDE branch touches
the filesystem.
Fix
Cache the answer and refresh it from the existing change sources (or a settings-portal
subscription, as portal_appearance already does for color-scheme), so focus handling does no
I/O.
Related: #527 asks for more Settings portal keys with change signals — this is the file-read path
it would replace.
There's another cost in the same lookup: the GSettings read dlopens libgio, and GLib's D-Bus, main-loop, dconf and thread-pool threads then stay for the life of the process.
For apps that supply reduced motion themselves (Cx::reduced_motion), our stopgap is an opt-out called before run (rune::leave_reduced_motion_to_app()), so Rune never looks it up. Reading it from the settings portal (#527) would remove both costs.
Previously, crates/rune/src/platform/preferences.rs read ~/.config/kdeglobals synchronously and dlopened libgio-2.0.so.0 on the UI thread on every focus change. Following Google Chrome (ui/gfx/animation/animation.cc, ui/linux/portal_settings_linux.cc, components/dbus/thread_linux/dbus_thread_linux.cc), GTK 4 (gdk/wayland/gdksettings-wayland.c), Qt 6 (QXdgDesktopPortalTheme), and the XDG Desktop Portal org.freedesktop.portal.Settings specification, Linux reduced motion is now cached in memory and kept up to date off the UI thread from org.freedesktop.appearancereduced-motion and org.gnome.desktop.interfaceenable-animations via SettingChanged on the shared portal worker thread. The kdeglobals / GSettings fallback now runs at most once off the UI thread only when the portal answers neither key (or when the dbus feature is off), avoiding both focus-time file I/O and unnecessary libgio loading.
Activity
purian23 commentedon Nov 12, 2026
There's another cost in the same lookup: the GSettings read
dlopens libgio, and GLib's D-Bus, main-loop, dconf and thread-pool threads then stay for the life of the process.For apps that supply reduced motion themselves (
Cx::reduced_motion), our stopgap is an opt-out called beforerun(rune::leave_reduced_motion_to_app()), so Rune never looks it up. Reading it from the settings portal (#527) would remove both costs.Hona commentedon Nov 23, 2026
Fixed on
devin #1766 (5126d252c).Previously,
crates/rune/src/platform/preferences.rsread~/.config/kdeglobalssynchronously anddlopenedlibgio-2.0.so.0on the UI thread on every focus change. Following Google Chrome (ui/gfx/animation/animation.cc,ui/linux/portal_settings_linux.cc,components/dbus/thread_linux/dbus_thread_linux.cc), GTK 4 (gdk/wayland/gdksettings-wayland.c), Qt 6 (QXdgDesktopPortalTheme), and the XDG Desktop Portalorg.freedesktop.portal.Settingsspecification, Linux reduced motion is now cached in memory and kept up to date off the UI thread fromorg.freedesktop.appearancereduced-motionandorg.gnome.desktop.interfaceenable-animationsviaSettingChangedon the shared portal worker thread. Thekdeglobals/ GSettings fallback now runs at most once off the UI thread only when the portal answers neither key (or when thedbusfeature is off), avoiding both focus-time file I/O and unnecessarylibgioloading.