# "New Task" launcher button In this example we are going to extend the functionality of Task Manager showcase (which comes by default with Trilium) by adding a button in the Launch Bar () to create a new task automatically and open it. ## Creating the note 1. First, create a new Code note type with the _JS frontend_ language. 2. Define the `#run=frontendStartup` label in Attributes. ## Content of the script Copy-paste the following script: ```javascript api.addButtonToToolbar({ title: "New task", icon: "task", shortcut: "alt+n", action: async () => { const taskNoteId = await api.runOnBackend(() => { const todoRootNote = api.getNoteWithLabel("taskTodoRoot"); const resp = api.createTextNote(todoRootNote.noteId, "New task", "") return resp.note.noteId; }); await api.waitUntilSynced(); await api.activateNewNote(taskNoteId); } }); ``` ## Testing the functionality Since we set the script to be run on start-up, all we need to do is to [refresh the application](../../Troubleshooting/Refreshing%20the%20application.md). ## Understanding how the script works
| This uses the Front-end API to create a icon in the Launch Bar, by specifying:
|
|
|
|
|
|
|
|
|
|
|