switches.rst 3.6 KB

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