Skip to main content

Disconnect the global hardware keyboard (key.disconnect_global_keyboard)

This function is available in versions after 20260805

Declaration

success, err = key.disconnect_global_keyboard()

Returns

  • success Boolean. Returns true after disconnection or when no global hardware keyboard is connected, and false on failure.
  • err String. Error message returned when disconnection fails.

Description

Releases all keys and disconnects the current global hardware keyboard. The existing key APIs resume their previous behavior afterwards.

  • This function may be called repeatedly. It also returns success when no global hardware keyboard is connected.
  • If the global hardware keyboard is running a :press or :send_text sequence, disconnection returns false, "hardware keyboard is busy".
  • Keys already held by key.down are released during disconnection. A later matching key.up does not send the input again.

Example

local success, err = key.disconnect_global_keyboard()
assert(success, err)