kmonad-0.4.1: Advanced keyboard remapping utility

Copyright(c) David Janssen 2019
LicenseMIT
Maintainerjanssen.dhj@gmail.com
Stabilityexperimental
Portabilitynon-portable (MPTC with FD, FFI to Linux-only c-code)
Safe HaskellNone
LanguageHaskell2010

KMonad.Keyboard.IO.Linux.Types

Contents

Description

 
Synopsis

The LinuxKeyEvent datatype, its constructors, and instances

Linux produces a stream of binary data representing all its input events through the /dev/input files. Each event is represented by 5 numbers: seconds, microseconds, event-type, event-code, and event-value. For more explanation look at: https://www.kernel.org/doc/Documentation/input/input.txt

linuxKeyEvent Source #

Arguments

:: (Integral a, Integral b, Integral c, Integral d, Integral e) 
=> (a, b, c, d, e)

The tuple representing the event

-> LinuxKeyEvent

The LinuxKeyEvent

A smart constructor that casts from any integral

sync :: SystemTime -> LinuxKeyEvent Source #

Constructor for linux sync events. Whenever you write an event to linux, you need to emit a sync to signal to linux that it should sync all queued updates.

Casting between KeyEvent and LinuxKeyEvent

We only represent a subset of all the possible input events produced by Linux. First of all, we disregard all event types that are not key events, so we quietly ignore all sync and scan events. There other other events that are there to do things like toggle LEDs on your keyboard that we also ignore.

Furthermore, within the category of KeyEvents, we only register presses and releases, and completely ignore repeat events.

The correspondence between LinuxKeyEvents and core KeyEvents can best be read in the above-mentioned documentation, but the quick version is this: Typ: 1 = KeyEvent (see below) 4 = scancode event (we neither read nor write) 0 = sync event (we don't read, but do generate for writing) Val: for keys: 0 = Release, 1 = Press, 2 = Repeat for sync: always 0 Code: for keys: an Int value corresponding to a keycode see: https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h for sync: always 0

toLinuxKeyEvent :: KeyEvent -> SystemTime -> LinuxKeyEvent Source #

Translate kmonad KeyEvent along with a SystemTime to LinuxKeyEvents for writing.

Reexport common modules