Misc. objects

TabletTool

class libinput.define.TabletTool(htablettool, libinput)

An object representing a tool being used by a device with the TABLET_TOOL capability.

Tablet events generated by such a device are bound to a specific tool rather than coming from the device directly. Depending on the hardware it is possible to track the same physical tool across multiple Device instances, see Tracking unique tools.

As long as a reference to a TabletTool is kept, multiple instances will compare equal if they refer to the same physical tool and the hardware supports it.

type

The tool type of a tool object.

See Vendor-specific tablet tool types for details.

Returns:The tool type for this tool object.
Return type:TabletToolType
tool_id

The tool ID of a tool object.

If nonzero, this number identifies the specific type of the tool with more precision than the type returned in type, see Vendor-specific tablet tool types. Not all tablets support a tool ID.

Tablets known to support tool IDs include the Wacom Intuos 3, 4, 5, Wacom Cintiq and Wacom Intuos Pro series.

Returns:The tool ID for this tool object or 0 if none is provided.
Return type:int
has_pressure()

Return whether the tablet tool supports pressure.

Returns:True if the axis is available, False otherwise.
Return type:bool
has_distance()

Return whether the tablet tool supports distance.

Returns:True if the axis is available, False otherwise.
Return type:bool
has_tilt()

Return whether the tablet tool supports tilt.

Returns:True if the axis is available, False otherwise.
Return type:bool
has_rotation()

Return whether the tablet tool supports z-rotation.

Returns:True if the axis is available, False otherwise.
Return type:bool
has_slider()

Return whether the tablet tool has a slider axis.

Returns:True if the axis is available, False otherwise.
Return type:bool
has_wheel()

Return whether the tablet tool has a relative wheel.

Returns:True if the axis is available, False otherwise.
Return type:bool
has_button(button)

Check if a tablet tool has a specified button.

Parameters:button (int) – Button to check for. See input.h.
Returns:True if the tool supports this button, False if it does not.
Return type:bool
is_unique()

Return True if the physical tool can be uniquely identified by libinput, or False otherwise.

If a tool can be uniquely identified, keeping a reference to the tool allows tracking the tool across proximity out sequences and across compatible tablets. See Tracking unique tools for more details.

Returns:True if the tool can be uniquely identified, False otherwise.
Return type:bool
serial

The serial number of a tool.

If the tool does not report a serial number, this method returns zero. See Tracking unique tools for details.

Returns:The tool serial number.
Return type:int

TabletPadModeGroup

class libinput.define.TabletPadModeGroup(hmodegroup, libinput)

A mode on a tablet pad is a virtual grouping of functionality, usually based on some visual feedback like LEDs on the pad.

The set of buttons, rings and strips that share the same mode are a “mode group”. Whenever the mode changes, all buttons, rings and strips within this mode group are affected. See Tablet pad modes for detail.

Most tablets only have a single mode group, some tablets provide multiple mode groups through independent banks of LEDs (e.g. the Wacom Cintiq 24HD). libinput guarantees that at least one mode group is always available.

index

The returned number is the same index as passed to tablet_pad_get_mode_group().

For tablets with only one mode this number is always 0.

Returns:The numeric index this mode group represents, starting at 0.
Return type:int
num_modes

Query the mode group for the number of available modes.

The number of modes is usually decided by the number of physical LEDs available on the device. Different mode groups may have a different number of modes. Use mode to get the currently active mode.

libinput guarantees that at least one mode is available. A device without mode switching capability has a single mode group and a single mode.

Returns:The number of modes available in this mode group.
Return type:int
mode

The current mode this mode group is in.

Returns:The numeric index of the current mode in this group, starting at 0.
Return type:int
has_button(button)

Devices without mode switching capabilities return True for every button.

Parameters:button (int) – A button index, starting at 0.
Returns:True if the given button index is part of this mode group or False otherwise.
Return type:bool
has_ring(ring)

Devices without mode switching capabilities return True for every ring.

Parameters:ring (int) – A ring index, starting at 0.
Returns:True if the given ring index is part of this mode group or False otherwise.
Return type:bool
has_strip(strip)

Devices without mode switching capabilities return True for every strip.

Parameters:strip (int) – A strip index, starting at 0.
Returns:True if the given strip index is part of this mode group or False otherwise.
Return type:bool
button_is_toggle(button)

The toggle button in a mode group is the button assigned to cycle to or directly assign a new mode when pressed.

Not all devices have a toggle button and some devices may have more than one toggle button. For example, the Wacom Cintiq 24HD has six toggle buttons in two groups, each directly selecting one of the three modes per group.

Devices without mode switching capabilities return False for every button.

Parameters:button (int) – A button index, starting at 0.
Returns:True if the button is a mode toggle button for this group, or False otherwise.
Return type:bool