Skip to content

Instantly share code, notes, and snippets.

@EastArctica
Created January 3, 2026 20:59
Show Gist options
  • Select an option

  • Save EastArctica/48163e2d156056f1be126ee190ad9e13 to your computer and use it in GitHub Desktop.

Select an option

Save EastArctica/48163e2d156056f1be126ee190ad9e13 to your computer and use it in GitHub Desktop.

How to use keybinds

Keybinds can be triggered in various ways, with the primary thing to keep in mind is that it operates based on presses and releases. There is no concept of a "full click" in jsmacros. Here are some examples:

// Log all keybinds to chat
KeyBind.getKeyBindings().forEach(JavaWrapper.methodToJava((bind, key) => {
    Chat.log(`- ${bind}: ${key}`);
}));

// Hold mine/attack
KeyBind.pressKeyBind("key.attack");

// Attack once every tick
const tickListener = JsMacros.on("tick", JavaWrapper.methodToJava(() => {
    KeyBind.pressKeyBind("key.attack");
    KeyBind.releaseKeyBind("key.attack");
}));

// Press and release the letter E
KeyBind.pressKey("e");
KeyBind.releaseKey("e");

// There are various ways to press keys
KeyBind.keyBind("key.left", true);
KeyBind.pressKeyBind("key.left");
KeyBind.key("a", true);
KeyBind.pressKey("a");

// and similarly for releasing
KeyBind.keyBind("key.left", false);
KeyBind.releaseKeyBind("key.left");
KeyBind.key("a", false);
KeyBind.releaseKey("a");

Vanilla keybind list

  • key.playerlist: key.keyboard.tab
  • key.sneak: key.keyboard.left.shift
  • key.hotbar.8: key.keyboard.8
  • key.hotbar.7: key.keyboard.7
  • key.sprint: key.keyboard.left.control
  • key.hotbar.6: key.keyboard.6
  • key.hotbar.5: key.keyboard.5
  • key.hotbar.4: key.keyboard.4
  • key.hotbar.3: key.keyboard.3
  • key.hotbar.2: key.keyboard.2
  • jsmacros.menu: key.keyboard.k
  • key.togglePerspective: key.keyboard.f5
  • key.hotbar.1: key.keyboard.1
  • key.spectatorOutlines: key.keyboard.unknown
  • key.left: key.keyboard.a
  • key.chat: key.keyboard.t
  • key.pickItem: key.mouse.middle
  • key.socialInteractions: key.keyboard.p
  • key.fullscreen: key.keyboard.f11
  • key.attack: key.mouse.left
  • key.smoothCamera: key.keyboard.unknown
  • key.advancements: key.keyboard.l
  • key.use: key.mouse.right
  • key.loadToolbarActivator: key.keyboard.x
  • key.hotbar.9: key.keyboard.9
  • key.forward: key.keyboard.w
  • key.right: key.keyboard.d
  • key.screenshot: key.keyboard.f2
  • key.back: key.keyboard.s
  • key.swapOffhand: key.keyboard.f
  • key.spectatorHotbar: key.mouse.middle
  • key.command: key.keyboard.slash
  • key.saveToolbarActivator: key.keyboard.c
  • key.inventory: key.keyboard.e
  • key.jump: key.keyboard.space
  • key.drop: key.keyboard.q
  • key.quickActions: key.keyboard.g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment