1.. _switches: 2 3============================================================================== 4Switches 5============================================================================== 6 7libinput supports the lid and tablet-mode switches. Unlike button events 8that come in press and release pairs, switches are usually toggled once and 9left at the setting for an extended period of time. 10 11Only some switches are handled by libinput, see **libinput_switch** for a 12list of supported switches. Switch events are exposed to the caller, but 13libinput may handle some switch events internally and enable or disable 14specific features based on a switch state. 15 16The order of switch events is guaranteed to be correct, i.e., a switch will 17never send consecutive switch on, or switch off, events. 18 19.. _switches_lid: 20 21------------------------------------------------------------------------------ 22Lid switch handling 23------------------------------------------------------------------------------ 24 25Where available, libinput listens to devices providing a lid switch. 26The evdev event code ``EV_SW`` ``SW_LID`` is provided as 27**LIBINPUT_SWITCH_LID**. If devices with a lid switch have a touchpad device, 28the device is disabled while the lid is logically closed. This is to avoid 29ghost touches that can be caused by interference with touchpads and the 30closed lid. The touchpad is automatically re-enabled whenever the lid is 31openend. 32 33This handling of lid switches is transparent to the user, no notifications 34are sent and the device appears as enabled at all times. 35 36On some devices, the device's lid state does not always reflect the physical 37state and the lid state may report as closed even when the lid is physicall 38open. libinput employs some heuristics to detect user input (specificially 39typing) to re-enable the touchpad on those devices. 40 41.. _switches_tablet_mode: 42 43------------------------------------------------------------------------------ 44Tablet mode switch handling 45------------------------------------------------------------------------------ 46 47Where available, libinput listens to devices providing a tablet mode switch. 48This switch is usually triggered on devices that can switch between a normal 49laptop layout and a tablet-like layout. One example for such a device is the 50Lenovo Yoga. 51 52The event sent by the kernel is ``EV_SW`` ``SW_TABLET_MODE`` and is provided as 53**LIBINPUT_SWITCH_TABLET_MODE**. When the device switches to tablet mode, 54the touchpad and internal keyboard are disabled. If a trackpoint exists, 55it is disabled too. The input devices are automatically re-enabled whenever 56tablet mode is disengaged. 57 58This handling of tablet mode switches is transparent to the user, no 59notifications are sent and the device appears as enabled at all times. 60