Skip to content

feat(linux): read double-click interval from XDG Settings portal with kdeglobals and GSettings fallback - #1923

Merged
Hona merged 1 commit into
devfrom
feat/545-linux-double-click-interval
Nov 24, 2026
Merged

Hona merged 1 commit into
devfrom
feat/545-linux-double-click-interval

Conversation

@Hona

@Hona Hona commented Nov 24, 2026

Copy link
Copy Markdown
Member

Fixes #545

Reads the Linux desktop's configured double-click interval instead of leaving Runtime::double_click_interval fixed at 0.5 s, bringing Linux in line with macOS (NSEvent::doubleClickInterval) and Windows (GetDoubleClickTime) without changing the public API.

Resolution order

flowchart LR
    A[rune-appearance-portal worker] -->|ReadOne / Read + SettingChanged| B["org.freedesktop.portal.Settings<br/>org.gnome.desktop.peripherals.mouse / double-click"]
    B -->|i32 / u32 ms, clamped 50..=5000| C[AtomicU32 cache]
    B -->|portal absent or key missing| D{XDG_CURRENT_DESKTOP<br/>includes KDE?}
    D -->|yes| E["kdeglobals<br/>[KDE] DoubleClickInterval"]
    D -->|no| F["dlopen libgio-2.0.so.0<br/>g_settings_get_int"]
    F -->|unavailable| E
    E -->|clamped 50..=5000 ms| C
    F -->|clamped 50..=5000 ms| C
    C -->|unanswered = 0.5 s| G[Host / Overlay rt.double_click_interval]
Loading

Changes

  • Settings portal watcher (crates/rune/src/platform/portal_appearance.rs): extend the existing rune-appearance-portal background worker to read and watch org.gnome.desktop.peripherals.mouse double-click (unwrapping nested Value::Value i32/u32 milliseconds, rejecting non-positive values, clamping to 50..=5000 ms), store it in an AtomicU32 with a portal-authority bit so a one-shot fallback never overwrites a portal answer, and request window redraws only when the effective interval changes.
  • Off-UI-thread fallback (crates/rune/src/platform/preferences.rs): expose preferences::double_click_interval() -> f64 (defaulting to 0.5 s) and read_double_click_fallback() -> Option<u32>, checking kdeglobals [KDE] DoubleClickInterval on KDE desktops and libgio-2.0.so.0 g_settings_get_int (with kdeglobals fallback if GIO or the schema is absent) elsewhere. When compiled without the dbus feature, run the fallback once on a short-lived worker thread (CachedDoubleClick). Shared with_gsettings handles schema lookup and reference cleanup for both enable-animations and double-click.
  • Host & overlay wiring (crates/rune/src/window/host/create.rs, crates/rune/src/window/host/events.rs, crates/rune/src/window/host/lifecycle.rs, crates/rune/src/input/host_events.rs, crates/rune/src/overlay.rs, crates/rune/src/overlay/lifetime.rs, crates/rune/src/overlay/any_host.rs): apply preferences::double_click_interval() on Linux window/overlay creation and refresh it from the cached atomic on portal-triggered redraws, reveals and focus changes with zero UI-thread D-Bus or filesystem I/O.
  • Docs & tests (crates/rune/src/runtime.rs, crates/rune/README.md, crates/rune/src/platform/portal_appearance_tests.rs, crates/rune/src/platform/preferences_tests.rs, changelog/unreleased/2026-11-24-linux-double-click-interval.md): document Linux support and cover decoding, clamping, kdeglobals parsing, fallback precedence, off-thread caching and atomic updates.

Outside answer followed

  • XDG Desktop Portal org.freedesktop.portal.Settings (org.gnome.desktop.peripherals.mouse double-click in ms), GNOME GSettings (org.gnome.desktop.peripherals.mouse double-click), and KDE KConfig (kdeglobals [KDE] DoubleClickInterval in ms), matching GTK 4, Chromium and Qt.
  • No App/Tx setter was added: system settings drive Runtime::double_click_interval on macOS and Windows already, and Runtime::double_click_interval remains unchanged for headless tests.

Notes on verification

  • Verified unit tests and compilation on Windows, Linux (aarch64 with dbus and --no-default-features), macOS, and wasm32 (WebGPU and WebGL2).
  • Not run on a live Linux desktop session with a running XDG Settings portal daemon or live libgio-2.0.so.0 GSettings database; that thin edge is compiled and unit-tested behind the pure decoding/clamping/parsing helpers.

@Hona
Hona merged commit c6506ae into dev Nov 24, 2026
1 check passed
@Hona
Hona deleted the feat/545-linux-double-click-interval branch November 24, 2026 13:27
Hona added a commit that referenced this pull request Nov 25, 2026
…une and procwatch (#2370)

A feature-set warning sweep across Linux, macOS, Windows, and wasm32 found
eight dead-code warnings under optional and non-default feature sets:

- `crates/rune/src/open_path.rs:203` (`file_uri_from_bytes`, added in #1947):
  used on Unix only under `feature = "dbus"` (FileManager1) and tests; gate
  with `feature = "dbus"` alongside `test`.
- `crates/rune/src/platform/preferences.rs:77` (`DEFAULT_DOUBLE_CLICK_SECS`,
  added in #1923/#2128): used on Linux only under `feature = "dbus"` and tests;
  gate with `all(target_os = "linux", feature = "dbus")` alongside `test`.
- `crates/rune/src/window/titlebar/linux.rs:82` (`Sides::ALL`, added in #2244):
  used only in `linux_tests.rs`; gate with `#[cfg(test)]`.
- `crates/rune/src/frame/live_log.rs:33` (`CAPTURED` / `capture_frames`, added
  in #2309): used only in `window/win32/resize_sync/tests.rs` under
  `frame-profile`; gate with `#[cfg(all(test, target_os = "windows"))]`.
- `crates/procwatch/src/alloc/sites.rs:222,271,413,418` (`report`, `unsampled`,
  `os::modules`, `os::nt_heaps`, added in #744): `alloc-sites` sampling and
  dumper are Windows-only; gate the implementation behind `#[cfg(windows)]`
  with clean `#[cfg(not(windows))]` no-op stubs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux: the double-click interval is fixed at 0.5 s

1 participant