How to create a cycling keyboard shortcut

For example, cycling of “brush type”: “Circle -> Rectangle -> Line -> Circle …”

We can associate a keyboard shortcut to a script.

The .LUA script file should be saved in the Script folder.

brushTypeCycling.lua:

local brushType = app.activeBrush.type
local brushAngle = app.activeBrush.angle
local brushSize = app.activeBrush.size
if app.activeBrush.type >= BrushType.LINE then
brushType = BrushType.CIRCLE
else
brushType = brushType + 1
end
app.activeBrush = Brush {
type = brushType,
size = brushSize,
angle = brushAngle
}

Then associate this script with a keyboard shortcut in
Edit > Keyboard Shortcut… > Commands > Run Script: “brushTypeCycling.lua”

You should restart Aseprite, if you already had ran Aseprite while you have made the script.

3 Likes

Actually Aseprite supports this for two tools from Edit > Preferences > Keyboard Shortcuts, anyway there is a bug that doesn’t make us associated the same shortcut for 3 or more tools. In this case the script is a good workaround.

1 Like