Skip to content

Linux: read Settings portal keys beyond color-scheme, with change signals #527

Done

Description

@wmfeht

Context: we're doing preliminary work on porting Strata (lgse/strata) from GTK 4 to Rune. Strata
follows the desktop's text scale, double-click time, cursor blink and animations switch. All live
in org.freedesktop.portal.Settings, which Rune already reads for color-scheme
(platform/portal_appearance.rs:15 at 5d421fd, unchanged at 29aacb6).

Repro. Any Rune window, on a private session bus with a fake portal
(fake_portal.py, PyGObject),
under a Wayland compositor (headless sway is enough):

use rune::{App, AppSpec, Cx, El, col, text};
fn view(_: &(), _: &mut Cx<()>) -> El { col().w_full().h_full().child(text("portal keys")) }
fn main() { App::new(AppSpec::new("portal", (320.0, 160.0), || (), view)).run(); }
cargo build
dbus-run-session -- sh -c '
  python3 -I fake_portal.py \
    --init "org.freedesktop.appearance color-scheme u 1; org.gnome.desktop.interface text-scaling-factor d 1.0; org.gnome.desktop.interface cursor-blink b true; org.gnome.desktop.interface cursor-blink-time i 1200; org.gnome.desktop.interface enable-animations b true; org.gnome.desktop.peripherals.mouse double-click i 400" \
    --schedule "3 org.gnome.desktop.interface text-scaling-factor d 1.5; 3.5 org.gnome.desktop.interface enable-animations b false; 4 org.gnome.desktop.peripherals.mouse double-click i 1200; 4.5 org.freedesktop.appearance color-scheme u 2" \
    > portal.log &
  sleep 1
  WAYLAND_DISPLAY=wayland-1 timeout 6 ./target/debug/portal
'
grep '"ev": "call"' portal.log

The fake portal served org.gnome.desktop.interface text-scaling-factor, cursor-blink,
cursor-blink-time and enable-animations, and
org.gnome.desktop.peripherals.mouse double-click, beside org.freedesktop.appearance color-scheme, and changed each on a schedule. Under headless sway at 78d22ed it logged one
call from Rune, ReadOne(org.freedesktop.appearance, color-scheme), and nothing else; the window
followed the color-scheme change only. Rune reads reduced motion from GSettings or kdeglobals
when a window is created or focused, which skips the portal (sandboxes) and its change signals.

Ask. The portal's values for these keys, or a generic Settings portal reader
(rune::settings::read(namespace, key) with a change callback), with change signals.

Related: #545 (the double-click interval Rune uses itself), #285 (dark mode detection on
DMS).

Activity

  1. opencodejr commented on Nov 25, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report and the fake-portal setup, @wmfeht.

    Some of this has landed on dev since the commits you tested (78d22ed, 5d421fd, 29aacb6 are from 7–10 Nov). In crates/rune/src/platform/portal_appearance.rs, the portal worker now reads these keys and follows SettingChanged for them:

    Still missing:

    • org.gnome.desktop.interface text-scaling-factor
    • cursor-blink and cursor-blink-time
    • a public way for apps to read any Settings portal key and be told when it changes (something like your rune::settings::read(namespace, key) with a change callback). The portal code is crate-internal today.

    We'll track those here as a feature request.

  2. opencodejr commented on Nov 25, 2026

    @opencodejr
    Contributor

    I've opened a PR that adds a general Settings portal reader. It hasn't been compiled or tested yet: there was no Rust toolchain where I made the change, so it needs cargo test and clippy before it can be merged.

    let handle = app.handle();
    let _text_scale = rune::desktop_setting("org.gnome.desktop.interface", "text-scaling-factor", move |v| {
        if let Some(scale) = v.as_f64() { handle.update(move |s, _| s.text_scale = scale); }
    });
    • When values arrive: you get the key's value once the portal answers, then each new value from SettingChanged, in order. Values come as a DesktopSetting: bool, integer, double or string.
    • Where callbacks run: on their own thread, so a slow or panicking callback doesn't hold up Rune's own color-scheme, reduced-motion or double-click updates.
    • Stopping: dropping the returned DesktopSettingWatch stops following the key.

    It works the same for cursor-blink, cursor-blink-time or any other key. Rune doesn't apply text scaling or cursor blink to its own text; apps decide what to do with the values.

    Running your fake portal against this branch under headless sway would be a useful end-to-end check.

    Fixed in #2193.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions