Skip to content

Instantly share code, notes, and snippets.

@andrewjmead
Created September 14, 2026 15:53
Show Gist options
  • Select an option

  • Save andrewjmead/126001541e4dfbe1ac116e43dd4a2a6c to your computer and use it in GitHub Desktop.

Select an option

Save andrewjmead/126001541e4dfbe1ac116e43dd4a2a6c to your computer and use it in GitHub Desktop.
karabiner.ts
import {
ifApp,
layer,
map,
rule,
writeToProfile,
mapPointingButton,
simlayer,
} from "karabiner.ts";
writeToProfile("Default", [
// rule("Basic modifications").manipulators([
// map("e", "command").to("spacebar", ["command", "control"]), // Emoji picker
// ]),
rule("Mouse").manipulators([
mapPointingButton("button4").to("mission_control"),
mapPointingButton("button5").to("spacebar", "command"),
]),
layer("caps_lock", "hyper")
.modifiers("??")
.configKey((capsLock) => capsLock.toIfAlone("escape"), true)
.manipulators([
map("spacebar").to("caps_lock", []),
map("q").to("mission_control"),
map("w").to("down_arrow", "control"), // Expose
map("h").to("left_arrow"),
map("j").to("down_arrow"),
map("k").to("up_arrow"),
map("l").to("right_arrow"),
map("u").to("[", ["command", "shift"]),
map("i").to("]", ["command", "shift"]),
map("y").to("y", ["command", "shift", "option", "control"]),
map("o").to("o", ["command", "shift", "option", "control"]),
map("quote").to("grave_accent_and_tilde"),
map("e").to("q", ["command", "control"]), // Lock
// Antinote
map("semicolon").to("a", "option"),
// Moom
map("1").to("1", ["command", "option", "control", "shift"]),
map("2").to("2", ["command", "option", "control", "shift"]),
// Tuna
// map("t").to("t", ["command", "option", "control", "shift"]), // Creates a loop
// Zed
map("f").to("l", ["command", "option"]).condition(ifApp("Zed")),
map("f").to("l", ["command", "option"]).condition(ifApp("PhpStorm")),
map("m").to("down_arrow", ['control', 'option', 'shift']).condition(ifApp("PhpStorm")),
map(",").to("up_arrow", ['control', 'option', 'shift']).condition(ifApp("PhpStorm")),
// Browser developer tools
// ?
// Fallback for unassigned keys. Breaks shift for selecting with arrows.
// map({
// any: "key_code",
// modifiers: { optional: ["any"] },
// }).to({ from_event: true, modifiers: ["command", "option", "control", "shift"] }),
]),
rule("GitHub Desktop", ifApp("GitHubClient")).manipulators([
map("k", "command").to("t", "command"),
]),
simlayer("return_or_enter", "enter-mode").manipulators([
map("l").to("j", ["command", "control"]), // Tuna
]),
simlayer("f", "f-mode").manipulators([
// map("j").to("spacebar", "command"), // Tuna
map("h").to("delete_or_backspace", "option"),
map("u").to("page_up", ["shift", "control"]),
map("i").to("page_down", ["shift", "control"]),
]),
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment