Skip to content

Customization

Daniel Imms edited this page May 8, 2022 · 3 revisions

This page contains some tips on customizing Luna Paint.

Default image size

The image size when creating a new image can be defined in the luna.defaultImageSize settings.

"luna.defaultImageSize": {
  "width": 1920,
  "height": 1080
}

Auto Save

Many people use auto save and it's enabled by default in GitHub Codespaces. Using it with Luna Piant has some consequences when working on larger images though as saves can be expensive (hopefully not forever, see Limitations). You may want to disable auto save if you edit larger images with this extension until a solution is worked out:

"files.autoSave": "off"

Don't open in edit mode by default

If you mostly view images and rarely edit images, it might be desirable to set the regular image preview extension as the default image editor. After opening Luna Paint for the first time you should see a notification asking to configure the default, you want to click the Configure Default button:

Then select Image Preview as the default:

Tip: If you have already set Luna Paint as the default you can clear this by removing luna.editor from the workbench.editorAssociations setting.

Now that Image Preview is the default, to open Luna Paint you need to run the View: Reopen Editor With command. If this is a common action you can setup a custom keybinding for it, for example:

{
  "key": "ctrl+k b",
  "command": "workbench.action.reopenWithEditor"
}

Free up memory of backgrounded tabs

Disabling luna.retainContextWhenHidden will dispose of editor contexts, slowing down tab restoring while freeing up memory. This is enabled by default because files where hot exit are disabled will lose changes when switching tabs. The recommendation for now is to set this to false if you work exclusively in small images.

"luna.retainContextWhenHidden": false

Avoiding conflicts in keybindings

To avoid conflicts between Luna Paint's keybindings and user defined keybindings, it's recommended to use the when clause luna:focused && activeCustomEditorId == 'luna.editor' or the inverse. For example:

// Only enable this keybinding when Luna Paint is not focused, such that it doesn't conflict with
// the default crop to selection keybinding.
{
  "key": "ctrl+shift+x",
  "command": "workbench.action.terminal.kill",
  "when": "!luna:focused && activeCustomEditorId != 'luna.editor'"
}

// Only enable this keybinding when Luna Paint is focused
{
  "key": "e",
  "command": "luna.image.expandCanvasToSelection",
  "when": "luna:focused && activeCustomEditorId == 'luna.editor'"
}