Creating Your First Widget
Create, run, and package your first Novadesk widget using nwm.
Table of Contents
This guide is based on the current nwm init template in the Novadesk project.
Prerequisites
- Novadesk is installed.
nwm.exeis available in your PATH (or run it from the Novadesk install directory).
1. Create a New Widget Project
Run:
bash
nwm init my-first-widgetThis creates a starter project:
- my-first-widget/
- meta.json
- index.js
- ui/
- script.ui.js
2. Understand the Starter Files
index.js (Main script)
Creates the widget window and points to the UI script.
javascript
import widgetWindow from "novadesk";
var myWindow = new widgetWindow({
id: "myWindow",
width: 200,
height: 200,
script: "ui/script.ui.js",
backgroundColor: "#ffffffff",
});ui/script.ui.js (UI script)
Draws content inside the window.
javascript
ui.addText({
id: "hello_Text",
x: 100,
y: 100,
width: 200,
height: 200,
text: "Hello World",
fontSize: 16,
fontColor: "#000000",
fontWeight: "bold",
fontFamily: "Arial",
textAlign: "centercenter",
});meta.json
Defines widget identity and installer/build settings.
3. Customize Your First Widget
Edit ui/script.ui.js and change text/style, for example:
javascript
ui.addText({
id: "hello_Text",
x: 20,
y: 20,
width: 160,
height: 60,
text: "Hello from Novadesk!",
fontSize: 18,
fontColor: "rgb(30,30,30)",
textAlign: "centercenter",
});4. Run the Widget
From the widget folder:
bash
cd my-first-widget
nwm runThis launches Novadesk and runs the widget from the current directory.
TIP
After editing files, use tray menu Refresh to reload scripts quickly.
5. Build for Distribution
Package your widget:
bash
nwm buildnwm build validates required meta.json fields before packaging.
Required top-level fields:
nameversionauthordescriptionicon
Required setup fields:
setup.installDirsetup.startMenuFoldersetup.setupNamesetup.setupIcon
Output is generated in dist/.
Next Steps
- Learn script roles in Script Types.
- Explore UI APIs from UI Object Methods.
- See packaging details in Widget Build And Installer.