Class SlowKeys

Class Documentation

class SlowKeys

Enables configuring slow keys at runtime.

Slow keys is an accessibility feature that enables the rejection of keypresses that don’t last long enough. It can be useful in cases where the user has issues that cause them to press buttons accidentally.

You can optionally assign handlers for when the key is pressed down, is rejected, or when the press is accepted.

Remark

Since MirAL 5.5

Public Functions

explicit SlowKeys(miral::live_config::Store &config_store)

Construct a SlowKeys instance with access to a live config store.

void operator()(mir::Server &server)
SlowKeys &enable()
SlowKeys &disable()
SlowKeys &hold_delay(std::chrono::milliseconds hold_delay)

Configures the duration a key has to be pressed down for to register as a key press.

SlowKeys &on_key_down(std::function<void(unsigned int)> &&on_key_down)

Configures the callback that’s invoked when the key is pressed down. Useful for providing feedback to users.

SlowKeys &on_key_rejected(std::function<void(unsigned int)> &&on_key_rejected)

Configures the callback that’s invoked when a press is rejected. Useful for providing feedback to users.

SlowKeys &on_key_accepted(std::function<void(unsigned int)> &&on_key_accepted)

Configures the callback that’s invoked when a press is accepted. Useful for providing feedback to users.

Public Static Functions

static auto enabled() -> SlowKeys

Creates a SlowKeys instance that’s enabled by default.

static auto disabled() -> SlowKeys

Creates a SlowKeys instance that’s disabled by default.