Safe Haskell | None |
---|---|
Language | Haskell2010 |
Provides support for generating a Karabiner config via Haskell.
Synopsis
- mkMain :: Root -> IO ()
- encodeRoot :: Root -> ByteString
- litPat :: Text -> Text
- data KeyBinding a = KeyBinding [a] KeyCode
- singleKey :: KeyCode -> KeyBinding PhysicalModifier
- (|->) :: KeyBinding a -> KeyBinding a -> [KeyBinding a]
- class ToKeyBinding a b c | a b -> c where
- (|+|) :: a -> b -> KeyBinding c
- class ManipulatorBuilder a b where
- (!>) :: a -> b -> Manipulator
- frontmostApplicationIf :: Manipulator -> [Text] -> Manipulator
- (?) :: Manipulator -> [Text] -> Manipulator
- (??) :: [Manipulator] -> [Text] -> [Manipulator]
- frontmostApplicationUnless :: Manipulator -> [Text] -> Manipulator
- (?!) :: Manipulator -> [Text] -> Manipulator
- (??!) :: [Manipulator] -> [Text] -> [Manipulator]
- data Root = Root {}
- data Rule = Rule {}
- data Manipulator = Manipulator {}
- data ManipulatorType = Basic
- manipulatorTypeToText :: ManipulatorType -> Text
- data ManipulatorFrom = ManipulatorFrom {}
- data ManipulatorTo = ManipulatorTo {}
- data ManipulatorCondition = ManipulatorCondition {}
- data ManipulatorConditionType
- manipulatorConditionTypeToText :: ManipulatorConditionType -> Text
- data FromModifiers = FromModifiers {}
- data PhysicalModifier
- data MetaModifier
- data AnyModifier
- class AsAnyModifier a where
- asAnyModifier :: a -> AnyModifier
- data KeyCode
- numbers :: [KeyCode]
- keyCodeToString :: IsString a => KeyCode -> a
Documentation
encodeRoot :: Root -> ByteString Source #
Encode a Root
to a JSON lazy ByteString.
data KeyBinding a Source #
Represents a key binding of [a]
modifiers (e.g. shift, control) and a key code.
The a
is polymorphic so we can make distinctions between PhysicalModifier
and MetaModifier.
KeyBinding [a] KeyCode |
Instances
(TypeError (('Text "Unsupported ManipulatorBuilder (!>) usage;" :$$: 'Text "'to' binding must use a PhysicalModifier (e.g. RightControl)") :$$: 'Text "not a MetaModifier (e.g. Control)") :: Constraint) => ManipulatorBuilder a (KeyBinding MetaModifier) Source # | |
Defined in Karabiner.Config (!>) :: a -> KeyBinding MetaModifier -> Manipulator Source # | |
AsAnyModifier a => ManipulatorBuilder (KeyBinding a) KeyCode Source # | |
Defined in Karabiner.Config (!>) :: KeyBinding a -> KeyCode -> Manipulator Source # | |
AsAnyModifier a => ManipulatorBuilder (KeyBinding a) [KeyBinding PhysicalModifier] Source # | |
Defined in Karabiner.Config (!>) :: KeyBinding a -> [KeyBinding PhysicalModifier] -> Manipulator Source # | |
AsAnyModifier a => ManipulatorBuilder (KeyBinding a) (KeyBinding PhysicalModifier) Source # | |
Defined in Karabiner.Config (!>) :: KeyBinding a -> KeyBinding PhysicalModifier -> Manipulator Source # |
singleKey :: KeyCode -> KeyBinding PhysicalModifier Source #
Key binding with no modifiers.
(|->) :: KeyBinding a -> KeyBinding a -> [KeyBinding a] infix 5 Source #
Helper for a key binding sequence, only slightly prettier than using a list.
class ToKeyBinding a b c | a b -> c where Source #
Type class for constructing a single key binding from multiple keys.
(|+|) :: a -> b -> KeyBinding c infix 6 Source #
Instances
ToKeyBinding MetaModifier KeyCode MetaModifier Source # | |
Defined in Karabiner.Config (|+|) :: MetaModifier -> KeyCode -> KeyBinding MetaModifier Source # | |
ToKeyBinding PhysicalModifier KeyCode PhysicalModifier Source # | |
Defined in Karabiner.Config | |
ToKeyBinding [MetaModifier] KeyCode MetaModifier Source # | |
Defined in Karabiner.Config (|+|) :: [MetaModifier] -> KeyCode -> KeyBinding MetaModifier Source # | |
ToKeyBinding [PhysicalModifier] KeyCode PhysicalModifier Source # | |
Defined in Karabiner.Config (|+|) :: [PhysicalModifier] -> KeyCode -> KeyBinding PhysicalModifier Source # |
class ManipulatorBuilder a b where Source #
Maps first KeyBinding
to second KeyBinding
We can map physical modifiers to physical modifiers or meta modifiers
to physical modifiers, but we can't (or rather, shouldn't) map
any modifiers to meta modifiers; these type class instances enforce this.
We provide an instance for this via TypeError
to provide nice error
messages.
(!>) :: a -> b -> Manipulator infix 4 Source #
Instances
(TypeError (('Text "Unsupported ManipulatorBuilder (!>) usage;" :$$: 'Text "'to' binding must use a PhysicalModifier (e.g. RightControl)") :$$: 'Text "not a MetaModifier (e.g. Control)") :: Constraint) => ManipulatorBuilder a (KeyBinding MetaModifier) Source # | |
Defined in Karabiner.Config (!>) :: a -> KeyBinding MetaModifier -> Manipulator Source # | |
AsAnyModifier a => ManipulatorBuilder (KeyBinding a) KeyCode Source # | |
Defined in Karabiner.Config (!>) :: KeyBinding a -> KeyCode -> Manipulator Source # | |
AsAnyModifier a => ManipulatorBuilder (KeyBinding a) [KeyBinding PhysicalModifier] Source # | |
Defined in Karabiner.Config (!>) :: KeyBinding a -> [KeyBinding PhysicalModifier] -> Manipulator Source # | |
AsAnyModifier a => ManipulatorBuilder (KeyBinding a) (KeyBinding PhysicalModifier) Source # | |
Defined in Karabiner.Config (!>) :: KeyBinding a -> KeyBinding PhysicalModifier -> Manipulator Source # |
frontmostApplicationIf :: Manipulator -> [Text] -> Manipulator Source #
Adds frontmost_application_if
condition to Manipulator
(?) :: Manipulator -> [Text] -> Manipulator Source #
Alias for frontmostApplicationIf
(??) :: [Manipulator] -> [Text] -> [Manipulator] Source #
Same as frontmostApplicationIf
except updates a list of Manipulator
frontmostApplicationUnless :: Manipulator -> [Text] -> Manipulator Source #
Adds frontmost_application_unless
condition to Manipulator
(?!) :: Manipulator -> [Text] -> Manipulator infix 3 Source #
Alias for frontmostApplicationUnless
(??!) :: [Manipulator] -> [Text] -> [Manipulator] Source #
Same as ?!
except updates a list of Manipulator
Most top-level node of the karabiner config
A set of manupulations that can be enabled or disabled via the
Complex modifications
section in the Karabiner UI.
data Manipulator Source #
A configured key rebinding
Instances
ToJSON Manipulator Source # | |
Defined in Karabiner.Config toJSON :: Manipulator -> Value # toEncoding :: Manipulator -> Encoding # toJSONList :: [Manipulator] -> Value # toEncodingList :: [Manipulator] -> Encoding # |
data ManipulatorType Source #
Instances
ToJSON ManipulatorType Source # | |
Defined in Karabiner.Config toJSON :: ManipulatorType -> Value # toEncoding :: ManipulatorType -> Encoding # toJSONList :: [ManipulatorType] -> Value # toEncodingList :: [ManipulatorType] -> Encoding # |
data ManipulatorFrom Source #
Instances
ToJSON ManipulatorFrom Source # | |
Defined in Karabiner.Config toJSON :: ManipulatorFrom -> Value # toEncoding :: ManipulatorFrom -> Encoding # toJSONList :: [ManipulatorFrom] -> Value # toEncodingList :: [ManipulatorFrom] -> Encoding # |
data ManipulatorTo Source #
Instances
ToJSON ManipulatorTo Source # | |
Defined in Karabiner.Config toJSON :: ManipulatorTo -> Value # toEncoding :: ManipulatorTo -> Encoding # toJSONList :: [ManipulatorTo] -> Value # toEncodingList :: [ManipulatorTo] -> Encoding # |
data ManipulatorCondition Source #
Instances
ToJSON ManipulatorCondition Source # | |
Defined in Karabiner.Config toJSON :: ManipulatorCondition -> Value # toEncoding :: ManipulatorCondition -> Encoding # toJSONList :: [ManipulatorCondition] -> Value # toEncodingList :: [ManipulatorCondition] -> Encoding # |
data ManipulatorConditionType Source #
Instances
ToJSON ManipulatorConditionType Source # | |
Defined in Karabiner.Config |
data FromModifiers Source #
Instances
ToJSON FromModifiers Source # | |
Defined in Karabiner.Config toJSON :: FromModifiers -> Value # toEncoding :: FromModifiers -> Encoding # toJSONList :: [FromModifiers] -> Value # toEncodingList :: [FromModifiers] -> Encoding # |
data PhysicalModifier Source #
Instances
ToJSON PhysicalModifier Source # | |
Defined in Karabiner.Config toJSON :: PhysicalModifier -> Value # toEncoding :: PhysicalModifier -> Encoding # toJSONList :: [PhysicalModifier] -> Value # toEncodingList :: [PhysicalModifier] -> Encoding # | |
AsAnyModifier PhysicalModifier Source # | |
Defined in Karabiner.Config | |
ToKeyBinding PhysicalModifier KeyCode PhysicalModifier Source # | |
Defined in Karabiner.Config | |
ToKeyBinding [PhysicalModifier] KeyCode PhysicalModifier Source # | |
Defined in Karabiner.Config (|+|) :: [PhysicalModifier] -> KeyCode -> KeyBinding PhysicalModifier Source # | |
AsAnyModifier a => ManipulatorBuilder (KeyBinding a) [KeyBinding PhysicalModifier] Source # | |
Defined in Karabiner.Config (!>) :: KeyBinding a -> [KeyBinding PhysicalModifier] -> Manipulator Source # | |
AsAnyModifier a => ManipulatorBuilder (KeyBinding a) (KeyBinding PhysicalModifier) Source # | |
Defined in Karabiner.Config (!>) :: KeyBinding a -> KeyBinding PhysicalModifier -> Manipulator Source # |
data MetaModifier Source #
Instances
ToJSON MetaModifier Source # | |
Defined in Karabiner.Config toJSON :: MetaModifier -> Value # toEncoding :: MetaModifier -> Encoding # toJSONList :: [MetaModifier] -> Value # toEncodingList :: [MetaModifier] -> Encoding # | |
AsAnyModifier MetaModifier Source # | |
Defined in Karabiner.Config | |
ToKeyBinding MetaModifier KeyCode MetaModifier Source # | |
Defined in Karabiner.Config (|+|) :: MetaModifier -> KeyCode -> KeyBinding MetaModifier Source # | |
(TypeError (('Text "Unsupported ManipulatorBuilder (!>) usage;" :$$: 'Text "'to' binding must use a PhysicalModifier (e.g. RightControl)") :$$: 'Text "not a MetaModifier (e.g. Control)") :: Constraint) => ManipulatorBuilder a (KeyBinding MetaModifier) Source # | |
Defined in Karabiner.Config (!>) :: a -> KeyBinding MetaModifier -> Manipulator Source # | |
ToKeyBinding [MetaModifier] KeyCode MetaModifier Source # | |
Defined in Karabiner.Config (|+|) :: [MetaModifier] -> KeyCode -> KeyBinding MetaModifier Source # |
data AnyModifier Source #
Instances
ToJSON AnyModifier Source # | |
Defined in Karabiner.Config toJSON :: AnyModifier -> Value # toEncoding :: AnyModifier -> Encoding # toJSONList :: [AnyModifier] -> Value # toEncodingList :: [AnyModifier] -> Encoding # |
class AsAnyModifier a where Source #
asAnyModifier :: a -> AnyModifier Source #
Instances
AsAnyModifier MetaModifier Source # | |
Defined in Karabiner.Config | |
AsAnyModifier PhysicalModifier Source # | |
Defined in Karabiner.Config |
Key codes available for binding The full list can be viewed in the Karabiner-Elements source https://github.com/tekezo/Karabiner-Elements/blob/master/src/share/types.hpp
A | |
B | |
C | |
D | |
E | |
F | |
G | |
H | |
I | |
J | |
K | |
L | |
M | |
N | |
O | |
P | |
Q | |
R | |
S | |
T | |
U | |
V | |
W | |
X | |
Y | |
Z | |
One | |
Two | |
Three | |
Four | |
Five | |
Six | |
Seven | |
Eight | |
Nine | |
Zero | |
Spacebar | |
Backspace | |
OpenBracket | |
CloseBracket | |
RightArrow | |
LeftArrow | |
UpArrow | |
DownArrow | |
ReturnOrEnter | |
Tab | |
Comma | |
Semicolon |
Instances
ToJSON KeyCode Source # | |
Defined in Karabiner.Config | |
ToKeyBinding MetaModifier KeyCode MetaModifier Source # | |
Defined in Karabiner.Config (|+|) :: MetaModifier -> KeyCode -> KeyBinding MetaModifier Source # | |
ToKeyBinding PhysicalModifier KeyCode PhysicalModifier Source # | |
Defined in Karabiner.Config | |
AsAnyModifier a => ManipulatorBuilder (KeyBinding a) KeyCode Source # | |
Defined in Karabiner.Config (!>) :: KeyBinding a -> KeyCode -> Manipulator Source # | |
ToKeyBinding [MetaModifier] KeyCode MetaModifier Source # | |
Defined in Karabiner.Config (|+|) :: [MetaModifier] -> KeyCode -> KeyBinding MetaModifier Source # | |
ToKeyBinding [PhysicalModifier] KeyCode PhysicalModifier Source # | |
Defined in Karabiner.Config (|+|) :: [PhysicalModifier] -> KeyCode -> KeyBinding PhysicalModifier Source # |
keyCodeToString :: IsString a => KeyCode -> a Source #