#!/bin/env bash

addApplications evremap

keymap() {

  sudo gpasswd -a $USER input
  echo 'KERNEL=="uinput", GROUP="input"' | sudo tee /etc/udev/rules.d/input.rules

  mkdir -p $HOME/.log
}

check() {
  if ! id | grep input >>/dev/null; then
    return 0
  fi

  if [ ! -f "/etc/udev/rules.d/input.rules" ]; then
    return 0
  fi

  if [ ! -d "$HOME/.log" ]; then
    return 0
  fi

  return 1
}

if check; then
  addActions keymap
fi
