kmonad
Safe HaskellSafe-Inferred
LanguageHaskell2010

KMonad.Keyboard.IO.Mac.Types

Synopsis

Documentation

data MacError Source #

Everything that can go wrong with Mac Key-IO

Constructors

NoMacKeycodeTo Keycode

Error translating to MacKeycode

NoMacKeycodeFrom MacKeycode

Error translating from MacKeycode

BadMacSwitch MacSwitch

Error interpreting MacSwitch

data MacKeyEvent Source #

MacKeyEvent is the C-representation of a a KeyEvent for our Mac API.

It contains a Word8 signifying whether the event was a Press (0) or Release (1), and a Word32 (uint32_t) signifying the Mac keycode (the upper 16 bits represent the IOKit usage page, and the lower 16 bits represent the IOKit usage).

NOTE: Mac and Linux keycodes do not line up. Internally we use Linux Keycodes for everything, we translate at the KeyIO stage (here).

toMacKeyEvent :: KeyEvent -> Either MacError MacKeyEvent Source #

Convert a KeyEvent to a MacKeyEvent

NOTE: Mac keycodes are different, and I am not confident I have full coverage, therefore this conversion is not total. We are going to leave this error-handling in until we are sure this is covered well. Once it lines up perfectly, this is essentially an Iso.

fromMacKeyEvent :: MacKeyEvent -> Maybe (Either [MacError] KeyEvent) Source #

Convert a MacKeyEvent to a KeyEvent

NOTE: Same limitations as toMacKeyEvent apply

kcMapRaw :: [(MacKeycode, Keycode)] Source #