"""WizardKit: Keyboard test functions"""
# vim: sts=2 sw=2 ts=2

import logging

from wk.exe import run_program
from wk.std import PLATFORM


# STATIC VARIABLES
LOG = logging.getLogger(__name__)


# Functions
def keyboard_test() -> None:
  """Test keyboard using OS specific functions."""
  if PLATFORM == 'Linux':
    run_xev()
  else:
    LOG.error('Not supported under this OS: %s', PLATFORM)
    raise NotImplementedError(f'Not supported under this OS: {PLATFORM}')


def run_xev() -> None:
  """Test keyboard using xev."""
  LOG.info('Keyboard Test (xev)')
  cmd = ['xev', '-event', 'keyboard']
  run_program(cmd, check=False, pipe=False)


if __name__ == '__main__':
  print("This file is not meant to be called directly.")
