mouse_settings

Factory Function

rivalcfg.mouse_settings.get_mouse_settings(vendor_id, product_id, mouse_profile, current_profile_name='default')

Returns a MouseSetting instance.

Note

A FakeMouseSettings instance is returned when DEBUG_DRY environment variable is set.

Parameters:
  • vendor_id (int) – The device’s vendor id (e.g. 0x1038).

  • product_id (int) – The device’s product id (e.g. ``0xbaad).

  • mouse_profile (dict) – The mouse profie (devices/*).

  • current_profile_name (str) – The name of the active profile (optional, default: "default").

:rtype MouseSettings, FakeMouseSettings

MouseSettings Class

class rivalcfg.mouse_settings.MouseSettings(vendor_id, product_id, mouse_profile, current_profile_name='default')

Stores the settings of a mouse.

Parameters:
  • vendor_id (int) – The device’s vendor id (e.g. 0x1038).

  • product_id (int) – The device’s product id (e.g. ``0xbaad).

  • mouse_profile (dict) – The mouse profie (devices/*).

  • current_profile_name (str) – The name of the active profile (optional, default: "default").

_load()

Load settings from a file.

Note

Settings are located in $XDG_CONFIG_HOME/rivalcfg/<vendor_id>_<product_id>.device.json.

create_settings_profile(profile_name, from_profile_name=None)

Create a new setting profile.

Warning

Not implemented yet!

Parameters:
  • profile_name (str) – The name of the new profile.

  • from_profile_name (str) – Clone the given profile name (optional, default: None).

get(setting_name)

Get the value of a setting.

Parameters:

setting_name (str) – The setting to set.

get_default_values()

Returns default settings of the device.

Return type:

dict

list_settings_profiles()

List available profiles.

Warning

Not implemented yet!

remove_settings_profile(profile_name)

Remove a profile.

Warning

Not implemented yet!

Parameters:

profile_name (str) – The name of the profile to remove.

save()

Save settings in a file.

Note

Settings are located in $XDG_CONFIG_HOME/rivalcfg/<vendor_id>_<product_id>.device.json.

set(setting_name, value)

Set a value to a setting.

Parameters:
  • setting_name (str) – The setting to set.

  • value – The value to set.

set_active_profile(profile_name)

Change the active profile.

Warning

Not implemented yet!

Parameters:

profile_name (str) – The name of the profile.

Helper functions

rivalcfg.mouse_settings.get_xdg_config_home()

Returns the path of the folder where to store the configs (generally $HOME/.config).

Return type:

str

rivalcfg.mouse_settings.get_settings_path(vendor_id, product_id)

Returns the path of a specific mouse settings file.

Parameters:
  • vendor_id (int) – The device’s vendor id (e.g. 0x1038).

  • product_id (int) – The device’s product id (e.g. 0xbaad).

Return type:

str