Skip to content

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

Done

Description

@wmfeht

Context: we're doing preliminary work on porting Strata (lgse/strata) from GTK 4 to Rune.

Repro (headless; ran at 5d421fd and 2a44156):

use rune::{Cx, El, Env, Runtime, col, el};
#[derive(Default)] struct S { doubles: u32 }
fn view(_: &S, _: &mut Cx<S>) -> El {
    col().w_full().h_full().child(el().key("dbl").size(200.0, 60.0).on_press(|_: &mut S| {}).on_double_press(|s: &mut S| s.doubles += 1))
}
fn main() {
    for gap in [0.45, 0.55] {
        let mut rt = Runtime::new(S::default(), view, (300.0, 200.0), Env::new(true, 1.0));
        rt.frame(0.0);
        let (x, y) = rt.find("dbl").unwrap();
        rt.pointer_move(x, y);
        rt.pointer_down(x, y); rt.pointer_up(x, y); rt.frame(gap);
        rt.pointer_down(x, y); rt.pointer_up(x, y); rt.frame(0.016);
        println!("presses {gap} s apart: doubles {}", rt.state.doubles);
    }
}

Output:

presses 0.45 s apart: doubles 1
presses 0.55 s apart: doubles 0

Under sway with GNOME's double-click set to 1200 ms, presses 583–1033 ms apart never pair
(measured at 78d22ed). macOS and Windows read the system value when a window is created
(window/create.rs:84–95 at 29aacb6); Linux doesn't. Runtime::double_click_interval is public, but a
windowed app has no Runtime. The interval also drives .window_drag()'s double-click
maximise, word and line selection, and Drag::clicks.

Ask. Read the desktop's interval on Linux (the Settings portal's
org.gnome.desktop.peripherals.mouse double-click, else GSettings, else kdeglobals'
DoubleClickInterval), or add App::double_click_interval(secs) and a Tx setter.

Related: #527 (Settings portal keys).

Activity

  1. Hona commented on Nov 24, 2026

    @Hona
    Member

    Implemented on dev in #1923 (c6506ae).

    Linux windows and overlays now read the desktop's double-click interval from the XDG Settings portal (org.gnome.desktop.peripherals.mouse double-click in ms, clamped to 50–5000 ms) on the existing background portal worker and follow live SettingChanged updates. When the portal does not answer that key (or the dbus feature is off), a one-shot off-UI-thread fallback reads kdeglobals ([KDE] DoubleClickInterval) on KDE desktops or GSettings via libgio-2.0.so.0 (falling back to kdeglobals) elsewhere, defaulting to 0.5 s when none answers. This follows XDG Desktop Portal, GNOME GSettings, and KDE KConfig (matching GTK 4, Chromium, Qt, and Rune's macOS/Windows behaviour).

    No App/Tx setter was added: system settings now drive the interval on all three desktop platforms, and Runtime::double_click_interval stays unchanged for headless tests. If you still have a use case that needs a programmatic per-app override, feel free to say so.

    Verified with unit tests and compiles on Windows, Linux (aarch64, with dbus and with --no-default-features), macOS, and wasm32 (WebGPU and WebGL2). Not verified on a live Linux desktop session against a running portal daemon or live GSettings database—those thin FFI/D-Bus edges were compiled and covered through unit tests for the decoding, clamping, kdeglobals parsing, fallback selection, and atomic state helpers.

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