karabiner.ts-greg-mods
Version:
Powerful mods for karabiner.ts.
98 lines (97 loc) • 3.5 kB
TypeScript
import { BasicManipulator, LayerKeyParam, Rule, ModifierParam, ToKeyParam, ToEventOptions, ToEvent, FromAndToKeyCode } from "karabiner.ts";
import { BasicManipulatorBuilder, FromAndToKeyParam } from "./karabiner-extra";
export type SlowManipulator = BasicManipulator & {
from: {
key_code: FromAndToKeyCode;
};
};
/**
* The hold-tap layer builder.
*/
export declare class HoldTapLayerBuilder {
private key;
private layer_builder;
private ruleDescription?;
private configKeyOptionalMods?;
private tappingTermMs?;
constructor(key: LayerKeyParam & FromAndToKeyParam);
/**
* Adds an event for the layer key is pressed alone.
*/
onAlone(toEvent: ToEvent | ToEvent[]): this;
/**
* Adds an event for the layer key is held down.
*
* It's useful for home-row mods.
*/
onHold(key: ToKeyParam, modifiers?: ModifierParam, options?: ToEventOptions): this;
/**
* Sets optional modifiers for the layer key.
*/
optionalModifiers(mods: ModifierParam): this;
/**
* Allows any modifiers to be used with the layer key.
*/
allowAnyModifiers(): this;
/**
* Sets the description for the rule.
*/
description(description: string): this;
/**
* Sets the tapping term in milliseconds.
*
* The tapping term is the time in milliseconds that the key must be held
* down in order to be fully active.
*/
tappingTerm(tappingTermMs: number): this;
build(): Rule;
/**
* Adds a regular manipulator to the layer.
*
* A regular manipulator always triggers when the layer key is pressed.
*
* This form of hold-tap decision making is called "hold on other key press"
* in QMK, hence the name.
*/
holdOnOtherKeyPressManipulator(manipulator: BasicManipulator | BasicManipulatorBuilder): this;
holdOnOtherKeyPressManipulators(manipulators: Parameters<typeof this.layer_builder.manipulators>[0]): this;
/**
* Adds an echo key.
*
* An echo key is just replayed back together with the layer key during the
* tapping term.
*
* It's useful for keys that might be rolled over often.
*/
echoKey(echoKey: FromAndToKeyParam): this;
echoKeys(...echoKeys: FromAndToKeyParam[]): this;
/**
* Adds a permissive hold manipulator.
*
* A permissive hold manipulator triggers either when the tapping term has
* elapsed or the manipulator's trigger has been tapped while holding the
* layer key.
*
* If neither of those things happened, the layer key and and the manipulator
* trigger are replayed as normal keys.
*/
permissiveHoldManipulator(manipulator: BasicManipulator | BasicManipulatorBuilder): this;
permissiveHoldManipulators(...manipulators: (BasicManipulator | BasicManipulatorBuilder)[]): this;
/**
* Adds a slow manipulator to the layer.
*
* A slow manipulator is a manipulator that only triggers when
* the tapping term has elapsed.
*/
slowManipulator(manipulator: SlowManipulator): this;
slowManipulators(...manipulators: (BasicManipulator | BasicManipulatorBuilder)[]): this;
private get layerVariable();
private get startVariable();
private get replayVariable();
private setOptionalConfigKeyModifiers;
private setTappingTerm;
}
/**
* Creates a builder for the hold-tap layer.
*/
export declare function holdTapLayer(key: LayerKeyParam): HoldTapLayerBuilder;