UNPKG

karabiner.ts-greg-mods

Version:
73 lines (72 loc) 3.11 kB
import { BasicManipulator, FromAndToKeyCode, KeyAlias, LayerKeyParam, Manipulator, ModifierParam, SideModifierAlias, ToKeyParam } from "karabiner.ts"; import { BasicManipulatorBuilder, FromAndToKeyParam, Side } from "./karabiner-extra"; export declare type LeftModifierFlag = "left" | "l" | "<" | "‹"; export type HrmKey = FromAndToKeyCode | KeyAlias; export type HrmMod = SideModifierAlias & ToKeyParam; export type HrmKeyParam = (FromAndToKeyCode | KeyAlias) & LayerKeyParam; export declare class HrmKeyboardLayout { readonly leftHandKeys: FromAndToKeyCode[]; readonly rightHandKeys: FromAndToKeyCode[]; constructor(leftHandKeys: Array<FromAndToKeyCode | KeyAlias>, rightHandKeys: Array<FromAndToKeyCode | KeyAlias>); } export declare const qwertyLayout: HrmKeyboardLayout; export type HoldTapStrategy = "permissive-hold" | "hold-on-other-key-press" | "slow"; /** * Given a key and a keyboard layout, returns which side ('left' | 'right') the key is on, * or null if the key is not found in either hand. */ export declare function getSideOfKey(key: FromAndToKeyCode, layout: HrmKeyboardLayout): Side | null; export declare class HrmBuilder { private readonly hrmKeys; private readonly keyboardLayout; private smartManipulatorMap; private smartKeyOverrideMap; private isLazy; private chosenHoldTapStrategy; private isChordalHold; private hasTriples; private simultaneousThresholdMs?; private tappingTermMs?; constructor(hrmKeys: Map<HrmKeyParam, HrmMod>, layout?: HrmKeyboardLayout); /** * Sets whether the modifiers are lazy. */ lazy(isLazy: boolean): this; /** * Sets the hold tap strategy for the builder. */ holdTapStrategy(strategy: HoldTapStrategy): this; /** * Enables or disables chordal hold. */ chordalHold(isChordalHold: boolean): this; /** * Sets whether the builder should generate 3-key chords. */ triples(hasTriples: boolean): this; /** * Sets the simultaneous threshold in milliseconds. * * Simultaneous threshold is the maximum time in milliseconds Karabiner will wait for a simultaneous * chord to appear for doubles and triples. */ simultaneousThreshold(simultaneousThresholdMs: number): this; /** * Sets the tapping term in milliseconds. */ tappingTerm(tappingTermMs: number): this; build(): Manipulator[]; smartManipulator(mod: ModifierParam, manipulator: BasicManipulator | BasicManipulatorBuilder): this; smartManipulators(mod: ModifierParam, ...manipulators: (BasicManipulator | BasicManipulatorBuilder)[]): this; /** * Adds some keys that override the default hold-tap strategy. */ keys(mod: ModifierParam, keys: FromAndToKeyParam[], strategy: HoldTapStrategy): this; /** * Creates all chorded modifiers for the home row mods. */ private tupleManipulators; private singleManipulators; private singleManipulatorLayer; } export declare function hrm(hrmKeys: Map<HrmKeyParam, SideModifierAlias & ToKeyParam>, layout?: HrmKeyboardLayout): HrmBuilder;