Use one unified widgets.json file for managing widgets in the sidebar (#1250)

Renames defaultwidgets.json file in defaultconfig to widgets.json and
removes references to defaultwidgets in the codebase and documentation.

Going forward, users will see one unified list of widgets in the sidebar
with no separator between default and custom widgets. Users can manually
move any edits to their defaultwidgets.json file into their widgets.json
file to get back their overrides.
This commit is contained in:
Evan Simkowitz 2024-11-08 14:14:59 -08:00 committed by GitHub
parent 92271408dc
commit 3216bc2389
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 20 deletions

View File

@ -59,7 +59,7 @@ There is no UI to edit your default terminal font family. But, it _can_ be overr
See [Custom Widgets](/customwidgets) for detailed documentation around changing what appears in your right widget sidebar.
Using widgets.json (and defaultwidgets.json) you'll be able to remove any default widgets and add widgets of your own. You can fully customize the icons, colors, text, and defaults (like directories, webpages, AI model, remote connection, commands, etc.) of your custom widgets.
Using widgets.json, you'll be able to remove any default widgets and add widgets of your own. You can fully customize the icons, colors, text, and defaults (like directories, webpages, AI model, remote connection, commands, etc.) of your custom widgets.
You can also suppress the help widgets in the bottom right by setting the config key `widget:showhelp` to `false`.

View File

@ -53,15 +53,9 @@ const Widgets = memo(() => {
},
};
const showHelp = fullConfig?.settings?.["widget:showhelp"] ?? true;
const showDivider = keyLen(fullConfig?.defaultwidgets) > 0 && keyLen(fullConfig?.widgets) > 0;
const defaultWidgets = sortByDisplayOrder(fullConfig?.defaultwidgets);
const widgets = sortByDisplayOrder(fullConfig?.widgets);
return (
<div className="workspace-widgets">
{defaultWidgets.map((data, idx) => (
<Widget key={`defwidget-${idx}`} widget={data} />
))}
{showDivider ? <div className="widget-divider" /> : null}
{widgets?.map((data, idx) => <Widget key={`widget-${idx}`} widget={data} />)}
{showHelp ? (
<>

View File

@ -259,7 +259,6 @@ declare global {
type FullConfigType = {
settings: SettingsType;
mimetypes: {[key: string]: MimeTypeConfigType};
defaultwidgets: {[key: string]: WidgetConfigType};
widgets: {[key: string]: WidgetConfigType};
presets: {[key: string]: MetaType};
termthemes: {[key: string]: TermThemeType};

View File

@ -1,6 +1,6 @@
{
"defwidget@terminal": {
"display:order": 1,
"display:order": -5
"icon": "square-terminal",
"label": "terminal",
"blockdef": {
@ -11,7 +11,7 @@
}
},
"defwidget@files": {
"display:order": 2,
"display:order": -4,
"icon": "folder",
"label": "files",
"blockdef": {
@ -22,7 +22,7 @@
}
},
"defwidget@web": {
"display:order": 3,
"display:order": -3,
"icon": "globe",
"label": "web",
"blockdef": {
@ -32,7 +32,7 @@
}
},
"defwidget@ai": {
"display:order": 4,
"display:order": -2,
"icon": "sparkles",
"label": "ai",
"blockdef": {
@ -42,7 +42,7 @@
}
},
"defwidget@sysinfo": {
"display:order": 5,
"display:order": -1,
"icon": "chart-line",
"label": "sysinfo",
"blockdef": {

View File

@ -119,13 +119,12 @@ type ConfigError struct {
}
type FullConfigType struct {
Settings SettingsType `json:"settings" merge:"meta"`
MimeTypes map[string]MimeTypeConfigType `json:"mimetypes"`
DefaultWidgets map[string]WidgetConfigType `json:"defaultwidgets"`
Widgets map[string]WidgetConfigType `json:"widgets"`
Presets map[string]waveobj.MetaMapType `json:"presets"`
TermThemes map[string]TermThemeType `json:"termthemes"`
ConfigErrors []ConfigError `json:"configerrors" configfile:"-"`
Settings SettingsType `json:"settings" merge:"meta"`
MimeTypes map[string]MimeTypeConfigType `json:"mimetypes"`
Widgets map[string]WidgetConfigType `json:"widgets"`
Presets map[string]waveobj.MetaMapType `json:"presets"`
TermThemes map[string]TermThemeType `json:"termthemes"`
ConfigErrors []ConfigError `json:"configerrors" configfile:"-"`
}
func goBackWS(barr []byte, offset int) int {