Repository navigation
feat(linux): rune::desktop_setting follows any XDG Settings portal key with change signals - #2193
Merged
Merged
Conversation
…y with change signals
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.
Adds
rune::desktop_setting(namespace, key, on_change) -> DesktopSettingWatchandrune::DesktopSetting(Bool,Int,Uint,Double,Str, withas_bool,as_i64,as_f64andas_str). Apps can follow any key of the XDG Settings portal, for exampleorg.gnome.desktop.interfacetext-scaling-factor,cursor-blinkorcursor-blink-time(#527).Not compiled or tested. There was no Rust toolchain (
cargo,rustc,rustup) where this change was made, so the checks the review asked for have not been run. Before merging, please run:cargo test -p rune --lib desktop_settingscargo test -p rune --doc desktop_setting(theno_runexample)cargo clippy -p rune --libcargo check -p rune --no-default-featuresOnly
scripts/file-size.shran: no errors, no new warnings.How it works
portal_appearance.rs). Following a key puts it on a queue of keys to read. In itsSettingChangedloop, the worker waits on both the signal stream and that queue, and reads each queued key withReadOne/Read(withRPC_TIMEOUT) between signals. A read never lands after a newer signal. Keys followed before the portal connects are read once it does.rune-desktop-settingsthread. It starts with the firstdesktop_settingcall and owns every watch. Values reach it in order and each callback runs undercatch_unwind(AssertUnwindSafe(..)). A callback that panics is dropped. The worker never runs app code, and it handles Rune's owncolor-scheme, reduced-motion,enable-animationsanddouble-clickkeys before passing a value on.#[must_use]DesktopSettingWatchremoves the watch.dbusfeature, or when no portal answers,on_changeis never called.changelog/unreleased/2026-11-25-linux-portal-desktop-setting.md.Tests
desktop_settings_tests.rs(not run yet):offerreturns false) instead of unwinding.decodefor each scalar type, double-wrapped values, and an array (which givesNone). This test only builds on Linux withdbus.Not checked against a live portal. The fake portal from #527 under headless sway would do that.
Not in this PR
Rune does not apply text scaling or cursor blink to its own text; apps read those values through this API.
Closes #527