// ktrl Example Configuration File
// -------------------------------
//
// ktrl config files use `ron` (Rust Object Notation) to serialize
// the text into the internal `cfg::Cfg` struct.
//
// - The full KEY_... listing can be found inside the `keys::KeyCode` enum
// - Layer entries are mapping between a source `KeyCode` into an `Action` (more on that below)
//
(
// ktrl will register a TapHold as an hold after 300ms
tap_hold_wait_time: 300,
// ktrl will register a TapDance if all taps occur within a 1000ms period (1s)
tap_dance_wait_time: 1000,
// Gives names to layers
layer_aliases: {
"base": 0,
"function_keys": 1,
"meta-disabled": 2,
"meta-enabled": 3,
},
layer_profiles: {
"function": Profile(
indices: [],
aliases: ["function_keys"],
),
"meta": Profile(
indices: [],
aliases: ["meta-enabled", "function_keys"]
),
"no-meta": Profile(
indices: [],
aliases: ["meta-disabled"],
),
},
layers: [
// Layer 0 (Base Layer)
//
// Layer 0 is a bit special.
// When ktrl stats-up, it automatically enables this layer.
// After that, it can never be turned off.
// I.E it configures the default behavior (when all other layers are off).
//
// All the layer entries repeat the same pattern.
// They map a source `KeyCode` to an `Action`.
//
{
KEY_LEFTMETA: Tap(Key(KEY_LEFTCTRL)),
KEY_RIGHTALT: TapHold(Key(KEY_RIGHTALT), ActivateProfile("meta")),
KEY_F1: TapHold(Key(KEY_F1), ToggleLayerAlias("function_keys")),
KEY_F3: TapHold(Key(KEY_F3), DeactivateAllProfiles),
},
// function_keys
{
// maps standard Mac keyboard to default to function keys.
KEY_BRIGHTNESSDOWN: Tap(Key(KEY_F1)), // 224
KEY_BRIGHTNESSUP: Tap(Key(KEY_F2)), // 225
KEY_SCALE: Tap(Key(KEY_F3)), // 120
KEY_DASHBOARD: Tap(Key(KEY_F4)), // 204
KEY_KBDILLUMDOWN: Tap(Key(KEY_F5)), //229
KEY_KBDILLUMUP: Tap(Key(KEY_F6)), // 230
KEY_PREVIOUSSONG: Tap(Key(KEY_F7)), // 165
KEY_PLAYPAUSE: Tap(Key(KEY_F8)), // 164
KEY_NEXTSONG: Tap(Key(KEY_F9)), // 163
KEY_MUTE: Tap(Key(KEY_F10)), // 113
KEY_VOLUMEDOWN: Tap(Key(KEY_F11)), // 114
KEY_VOLUMEUP: Tap(Key(KEY_F12)), // 115
},
// meta-disabled
{
KEY_LEFTMETA: Tap(Key(KEY_LEFTCTRL)),
KEY_RIGHTALT: TapHold(Key(KEY_RIGHTALT), ActivateProfile("meta")),
},
// meta-enabled
{
KEY_LEFTMETA: Tap(Key(KEY_LEFTMETA)),
KEY_RIGHTALT: TapHold(Key(KEY_RIGHTALT), ActivateProfile("no-meta")),
},
],
)