You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/customwidgets.mdx
+44-8Lines changed: 44 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -66,7 +66,7 @@ This `WidgetConfigType` is shared between all types of widgets. That is to say,
66
66
67
67
The other options are part of the inner `MetaTSType` (outlined in blue in the image). This contains all of the details about how the widget actually works. The valid keys vary with each type of widget. They will be individually explored in more detail below.
68
68
69
-
# Terminal and CLI Widgets
69
+
##Terminal and CLI Widgets
70
70
71
71
A terminal widget, or CLI widget, is a widget that simply opens a terminal and runs a CLI command. They tend to look something like the example below:
72
72
@@ -80,7 +80,7 @@ A terminal widget, or CLI widget, is a widget that simply opens a terminal and r
80
80
"blockdef": {
81
81
"meta": {
82
82
"view": "term",
83
-
"controller": "cmd"
83
+
"controller": "cmd",
84
84
"cmd": "<the actual cli command>"
85
85
}
86
86
}
@@ -110,7 +110,7 @@ The `WidgetConfigType` takes the usual options common to all widgets. The `MetaT
110
110
| "term:localshellpath" | (optional) Sets the shell used for running your widget command. Only works locally. If left blank, wave will determine your system default instead. |
111
111
| "term:localshellopts" | (optional) Sets the shell options meant to be used with `"term:localshellpath"`. This is useful if you are using a nonstandard shell and need to provide a specific option that we do not cover. Only works locally. Defaults to an empty string. |
112
112
113
-
## Example Shell Widgets
113
+
###Example Local Shell Widgets
114
114
115
115
If you have multiple shells installed on your machine, there may be times when you want to use a non-default shell. For cases like this, it is easy to create a widget for each.
116
116
@@ -172,7 +172,29 @@ It is possible that `pwsh` is not in your path. If this is true, using `"pwsh"`
172
172
Windows. but it may be different on your system. Also note that both `pwsh.exe` and `pwsh` work on Windows, but only `pwsh` works on Unix systems.
173
173
:::
174
174
175
-
## Example Cmd Widgets
175
+
### Example Remote Shell Widgets
176
+
177
+
If you want to open a terminal widget for a particular connection (SSH or WSL), you can use the `connection` meta key. The connection key's value should match connections.json (or what's in your connections dropdown menu). Note that you should only use the canonical name (do not use any custom "display:name" that you've set). For WSL that might look like `wsl://Ubuntu`, and for SSH connections that might look like `user@remotehostname`.
178
+
179
+
```json
180
+
{
181
+
<... other widgets go here ...>,
182
+
"remote-term": {
183
+
"icon": "rectangle-terminal",
184
+
"label": "remote",
185
+
"blockdef": {
186
+
"meta": {
187
+
"view": "term",
188
+
"controller": "shell",
189
+
"connection": "<connection>"
190
+
}
191
+
}
192
+
},
193
+
<... other widgets go here ...>
194
+
}
195
+
```
196
+
197
+
### Example Cmd Widgets
176
198
177
199
Here are a few simple cmd widgets to serve as examples.
178
200
@@ -227,7 +249,7 @@ This adds an icon to the widget bar that you can press to launch a terminal runn
227
249
228
250
Because this is a TUI app that does not return anything when closed, the `"cmd:clearonstart"` option doesn't change the behavior, so it has been excluded.
229
251
230
-
# Web Widgets
252
+
##Web Widgets
231
253
232
254
Sometimes, it is desireable to open a page directly to a website. That can easily be accomplished by creating a custom `"web"` widget. They have the following form in general:
233
255
@@ -256,7 +278,7 @@ The `WidgetConfigType` takes the usual options common to all widgets. The `MetaT
256
278
| "url" | This string is the url of the current page. As part of a widget, it will serve as the page the widget starts at. If not specified, this will default to the globally configurable `"web:defaulturl"` which is [https://github.com/wavetermdev/waveterm](https://github.com/wavetermdev/waveterm) on a fresh install. |
257
279
| "pinnedurl" | (optional) This string is the url the homepage button will take you to. If not specified, this will default to the globally configurable `"web:defaulturl"` which is [https://github.com/wavetermdev/waveterm](https://github.com/wavetermdev/waveterm) on a fresh install. |
258
280
259
-
## Example Web Widgets
281
+
###Example Web Widgets
260
282
261
283
Say you want a widget that automatically starts at YouTube and will use YouTube as the home page. This can be done using:
262
284
@@ -304,7 +326,7 @@ Alternatively, say you want a web widget that opens to github as if it were a bo
304
326
This adds an icon to the widget bar that you can press to launch a web widget on the github homepage.
305
327

306
328
307
-
# Sysinfo Widgets
329
+
##Sysinfo Widgets
308
330
309
331
The Sysinfo Widget is intentionally kept to a very small subset of possible values that we will expand over time. But it is still possible to configure your own version of it—for instance, if you want to load a different plot by default. The general form of this widget is:
310
332
@@ -334,7 +356,7 @@ The `WidgetConfigType` takes the usual options common to all widgets. The `MetaT
334
356
| "graph:numpoints" | The maximum amount of points that can be shown on the graph. Equivalently, the number of seconds the graph window covers. This defaults to 100.|
335
357
| "sysinfo:type" | A string representing the collection of types to show on the graph. Valid values for this are `"CPU"`, `"Mem"`, `"CPU + Mem"`, and `All CPU`. Note that these are case sensitive. If no value is provided, the plot will default to showing `"CPU"`.|
336
358
337
-
## Example Sysinfo Widgets
359
+
###Example Sysinfo Widgets
338
360
339
361
Suppose you have a build process that lasts 3 minutes and you'd like to be able to see the entire build on the sysinfo graph. Also, you would really like to view both the cpu and memory since both are impacted by this process. In that case, you can set up a widget as follows:
340
362
@@ -381,3 +403,17 @@ Now, suppose you are fine with the default 100 points (and 100 seconds) but woul
381
403
This adds an icon to the widget bar that you can press to launch All CPU plots by default.
382
404
383
405

406
+
407
+
## Overriding Default Widgets
408
+
409
+
Wave ships with 5 default widgets in the widgets bar (terminal, files, web, ai, and sysinfo). You can modify or remove these by overriding their config in widgets.json. The names of the 5 widgets, in order, are:
410
+
411
+
-`defwidget@terminal`
412
+
-`defwidget@files`
413
+
-`defwidget@web`
414
+
-`defwidget@ai`
415
+
-`defwidget@sysinfo`
416
+
417
+
To remove any of them, just set that key to `null` in your widgets.json file.
418
+
419
+
To see their definitions, to copy/paste them, or to understand how they work, you can view all of their definitions on [GitHub - default widgets.json](https://github.com/wavetermdev/waveterm/blob/main/pkg/wconfig/defaultconfig/widgets.json)
0 commit comments