Keybindings
Register the osu! defaults, inspect an action, and replace its assigned keys.
manage-keybinds
Registers the default osu! bindings, prints one action, and remaps it.
sh
cd examples/manage-keybinds
npm install
npm startRegister the built-in osu! defaults first. The result reports how many bindings were inserted and how many obsolete defaults were removed.
js
View sourceconst r = osu.keybindings.registerDefaults(OSU_DEFAULTS, RulesetName.Osu)
console.log(`osu! defaults - inserted: ${r.inserted}, removed: ${r.removed}`)
Read the keys currently assigned to LeftButton, then replace them with the A key and the left mouse button. String key names and InputKey values can be mixed.
js
View sourceconst keys = osu.keybindings.getActionKeys(RulesetName.Osu, 'LeftButton')
console.log(`LeftButton: ${keys.join(', ')}`)
osu.keybindings.setActionKeys(RulesetName.Osu, 'LeftButton', ['A', InputKey.MouseLeft])
console.log(`After: ${osu.keybindings.getActionKeys(RulesetName.Osu, 'LeftButton').join(', ')}`)
API used: init · OsuFilesAPI#keybindings · InputKey · RulesetName