Adding a tab to preferences via plugin possible?

Hello and good day,

is it possible to create a tab in the preferences window via a plugin?

I would like to create a plugin where you can create snippets.
Thouse snippets could be managed in the preferences in multiple textareas (lets say snippet 1 to 10).
Then those snippets could be pasted via context menu like snippets / 1 - 10.

I haven’t found a plugin example of how to add a tab to the preferences. Perhaps you could give me a hint to the right direction.

All the best.

I don’t know how to add a tab to the preferences window, but here are some ideas which may be useful.

You can detect whether your plugin is running in the preferences window by using inkdrop.windowType in your activate function like so:

export function activate() {
  if (inkdrop.windowType === 'preferences') {
    // Modify the page content to add a new tab?

You could also let the user configure their snippets via the plugin’s config like so (note that textareas this way are currently impossible, but for single-line snippets this works fine):

export const config = {};

for (let i = 1; i <= 5; i++) {
  config[`snippet${i}`] = {
    title: `Snippet ${i}`,
    type: 'string',
    default: '',

Looks like this:

Or you could use my snippets plugin, which doesn’t work via the context menu but does let you type something, press Tab and have it expanded into the content of the snippet.


Thank you very much @jmerle for the helpfull tips of how adding fields to the settings!

The snippets plugin is also pretty handy and a new line could be achieved with \n there. So the lack of textareas is not that of an issue for me.

Good to hear :slight_smile:

In addition to “\n”, because my plugin evaluates the snippet’s content as JavaScript, you can also use a configuration like this with my plugin to create a snippet containing multiple lines:

        trigger: 'multiline',
        content: `
Line 1
Line 2
Line 3
1 Like

Hi Marco,

Thanks for the question.
Adding a tab to preferences is not supported at the moment.
Instead, I’d recommend you to use MessageDialog to provide UI for managing snippets if Inkdrop’s config is not sufficient.