Class MouseKeysConfig

Class Documentation

class MouseKeysConfig

Enables configuring mousekeys at runtime.

Mousekeys is an accessibility feature that allows users to control the pointer with their keyboard. The default keymap uses numpad 8, 2, 4, 6 for up, down, left, and right repsectively. Single clicks can be dispatched with 5, and double clicks with +. Holds can be initiated with 0, and releases with .. Users can switch between left, middle, and right click with /, *, and - respectively.

Remark

Since MirAL 5.3

Public Functions

explicit MouseKeysConfig(bool enabled_by_default)
explicit MouseKeysConfig(live_config::Store &config_store)

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

Available options:

  • {mouse_keys, enable}: Enable or disable mousekeys.

  • {mouse_keys, acceleration, constant_factor}: The base speed for mousekey pointer motion

  • {mouse_keys, acceleration, linear_factor}: The linear speed increase for mousekey pointer motion

  • {mouse_keys, acceleration, quadratic_factor}: The quadratic speed increase for mousekey pointer motion

  • {mouse_keys, max_speed_x}: The maximum mousekeys speed on the x axis

  • {mouse_keys, max_speed_x}: The maximum mousekeys speed on the y axis

void operator()(mir::Server &server) const
void enabled(bool enabled) const

Enables or disables mousekeys depending on the passed parameter.

void enable() const

Enables mousekeys. When already enabled, further calls have no effect.

Remark

Since MirAL 5.5

void disable() const

Disables mousekeys. When already disabled, further calls have no effect.

Remark

Since MirAL 5.5

void set_keymap(mir::input::MouseKeysKeymap const &new_keymap) const

Changes the keymap for the various mousekeys actions defined in mir::input::MouseKeysKeymap::Action.

Note

If a certain action not mapped to any key, it will be disabled.

void set_acceleration_factors(double constant, double linear, double quadratic) const

Sets the factors used to accelerate the pointer during motion. Follows the equation: constant + linear * time + quadratic * time^2. Where time is the time since the cursor has started moving.

Note

The default acceleration factors are constant=100, linear=100, and quadratic=30

void set_max_speed(double x_axis, double y_axis) const

Sets the maximum speed in pixels/s for the pointer on the x and y axes respectively.

Note

The default maximum speed is x_axis=400 and y_axis=400

Public Static Functions

static auto enabled() -> MouseKeysConfig

Creates a MouseKeysConfig instance that’s enabled by default.

Remark

Since MirAL 5.5

static auto disabled() -> MouseKeysConfig

Creates a MouseKeysConfig instance that’s disabled by default.

Remark

Since MirAL 5.5