What should I use to get the double-click time?

Ref: Previous inconclusive discussion from 2021.

I want to read the double-click time delay set by Settings.

Use case: Rust applications that use the Rust “Winit” crate, which feeds click events to the application without recognizing double clicks. Currently, programs using the Egui/Winit stack use a compile time constant. (0.3 secs.). System settings are ignored.

So, assuming the Linux platform is using Gnome Settings, how is that value read? Thanks.

Unfortunately there’s no cross-desktop standard for settings like this. GTK has a setting called gtk-double-click-time. On Wayland, it’s implemented by reading a GNOME-specific setting via the Settings portal (over D-Bus), or by reading that setting directly using the GSettings API when outside of flatpak.

Using the Settings portal is probably your best option. There’s apparently a native Rust implementation available:

The namespace is org.gnome.desktop.peripherals.mouse, and the key is double-click.

That said, I’ve just discovered that the portal implementations (xdg-desktop-portal-gtk and -gnome) are still using an old schema name, so that setting is currently broken. You can still use it with the hardcoded fallback that you need anyway, and it will start working once they’re fixed (PRs incoming).

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.