-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkarabiner.ts
executable file
·34 lines (29 loc) · 1.02 KB
/
karabiner.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /usr/bin/env -S mise x deno@latest -- deno run --allow-env --allow-read --allow-write
import {
DeviceIdentifier,
ModifierParam,
map as from,
ifApp,
ifDevice,
rule,
withCondition,
writeToProfile
} from 'https://deno.land/x/[email protected]/deno.ts';
const footPedal: DeviceIdentifier = { product_id: 45057, vendor_id: 13651 };
writeToProfile('Default', [
rule("Caps-lock to escape when alone, hyper when used as modifier, caps-lock when used with Option").manipulators([
from("caps_lock", "left_option").to("caps_lock"),
from("caps_lock").toHyper().toIfAlone("escape")
]),
rule("Foot Pedals", ifDevice(footPedal)).manipulators([
withCondition(ifApp({ bundle_identifiers: [/^io\.mpv$/], file_paths: ["^/opt/homebrew/bin/mpv$"] }))([
from("a").to("rewind"),
from("b").to("play_or_pause"),
from("c").to("fastforward")
]),
from("a", "left_option").to("caps_lock"),
from("a").toHyper().toIfAlone("escape"),
from("b").to("m", "Hyper"),
from("c").to("left_command")
])
])