Skip to content

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.

Full source

sh
cd examples/manage-keybinds
npm install
npm start

Register the built-in osu! defaults first. The result reports how many bindings were inserted and how many obsolete defaults were removed.

js
const 
r
=
osu
.
keybindings
.
registerDefaults
(
OSU_DEFAULTS
,
RulesetName
.
Osu
)
console
.
log
(`osu! defaults - inserted: ${
r
.
inserted
}, removed: ${
r
.
removed
}`)
View source

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
const 
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
(', ')}`)
View source

API used: init · OsuFilesAPI#keybindings · InputKey · RulesetName

Released under the MIT License.