tps.input

Logic related to input devices.

exception tps.input.InputDeviceNotFoundException

xinput device could not be found.

tps.input.generate_xinput_coordinate_transformation_matrix(output, orientation)

Generates the coordinate transformation matrix that is needed for xinput to confine the input to one screen and rotate it properly.

0.415703, 0.000000, 0.584297, 0.000000, -0.711111, 0.711111, 0.000000, 0.000000, 1.000000

tps.input.get_wacom_device_ids()

Gets the IDs of the built-in Wacom touch devices.

This calls xinput to get the list and parses that with a regular expression. Only device names starting with Wacom ISD (default regex) are taken into account. If you have an external device, this will not be picked up.

Return type:list
tps.input.get_xinput_id(name)

Gets the xinput ID for given device.

The first parts of the name may be omitted. To get “TPPS/2 IBM TrackPoint”, it is sufficient to use “TrackPoint”.

Raises:InputDeviceNotFoundException – Device not found in xinput output
Return type:int
tps.input.get_xinput_state(device)

Gets the device state.

Parameters:device (int) – xinput ID of devicwe
Returns:Whether device is enabled
Return type:bool
tps.input.has_device_property(device, property_)

Checks whether a given device supports a property.

tps.input.has_xinput_prop(device, prop)

Checks whether the device has the given xinput propery.

tps.input.map_rotate_all_input_devices(output, orientation)

Maps all Wacom® devices.

tps.input.map_rotate_input_device(device, matrix)

Rotates an input device.

tps.input.map_rotate_wacom_device(device, output, direction)
tps.input.set_wacom_touch(device_id, state)

Changes the Wacom Touch property of the given device.

tps.input.set_xinput_state(device, state)

Sets the device state.

Parameters:
  • device (int) – xinput ID of devicwe
  • state (bool) – Whether device should be enabled
tps.input.state_change_ui(config_name)

Change the state of the given device depending on command line options.

It parses the command line options. If no state is given there, it will be the opposite of the current state.

Parameters:set_touch (bool) – Whether to also toggle the Touch property on this device.
Returns:None
tps.input.wacom_rotate_reset(device)

Resets the “Wacom Rotation” property of devices.

In GH-117 we noticed that in Ubuntu the xrandr rotation command will also rotate some input devices. This is probably meant in a good way but interferes with our rotation here. Therefore we reset the “Wacom Rotation” after setting the transformation matrix.