Raxol.Core.Runtime.Events.Keyboard (Raxol v0.4.0)

View Source

Handles keyboard event processing in the Raxol system.

This module is responsible for:

  • Processing keyboard events
  • Handling special key combinations
  • Converting keyboard events to application messages

Summary

Functions

Checks if a key combination matches any of the application's registered shortcuts.

Converts a keyboard event to an application message.

Processes a keyboard event and determines if it should be handled by the application or if it's a system-level command.

Functions

check_shortcuts(event, shortcuts)

Checks if a key combination matches any of the application's registered shortcuts.

Parameters

  • event: The keyboard event to check
  • shortcuts: Map of registered shortcuts

Returns

{:ok, action} if a match is found, :none otherwise.

convert_to_message(event)

Converts a keyboard event to an application message.

Parameters

  • event: The keyboard event to convert

Returns

A message that can be understood by the application's update function.

process_keyboard_event(event, state)

Processes a keyboard event and determines if it should be handled by the application or if it's a system-level command.

Parameters

  • event: The keyboard event to process
  • state: The current application state

Returns

{:system, command, state} if it's a system command, {:application, event, state} if it should be handled by the application, {:ignore, state} if the event should be ignored.