From 052e490f8f1bc88bd8d762ecf5445c41c333a0e9 Mon Sep 17 00:00:00 2001 From: lars-berger Date: Fri, 27 Sep 2024 14:28:15 +0800 Subject: [PATCH] feat: rename windows -> widgets; add json schema for configs (#110) --- README.md | 6 +- .../boilerplates/react-buildless/index.html | 6 +- .../react-buildless/my-window.zebar.json | 36 ++-- .../solid-ts/my-window.zebar.json | 36 ++-- examples/boilerplates/solid-ts/src/index.tsx | 6 +- examples/starter/vanilla.html | 6 +- examples/starter/vanilla.zebar.json | 36 ++-- examples/starter/with-glazewm.html | 6 +- examples/starter/with-glazewm.zebar.json | 36 ++-- examples/starter/with-komorebi.html | 6 +- examples/starter/with-komorebi.zebar.json | 36 ++-- .../client-api/src/desktop/current-window.ts | 80 -------- .../src/desktop/desktop-commands.ts | 43 ++--- .../src/desktop/get-open-window-args.ts | 17 -- packages/client-api/src/desktop/index.ts | 6 +- packages/client-api/src/desktop/monitors.ts | 62 ++++-- .../{desktop-events.ts => provider-emit.ts} | 7 +- .../client-api/src/desktop/shared/index.ts | 2 - .../src/desktop/shared/monitor-info.model.ts | 8 - .../src/desktop/shared/window-state.model.ts | 9 - packages/client-api/src/desktop/widgets.ts | 62 ++++++ packages/client-api/src/desktop/windows.ts | 39 ++++ packages/client-api/src/index.ts | 11 +- packages/client-api/src/init.ts | 69 ------- .../src/providers/create-provider-group.ts | 5 +- .../src/providers/create-provider.ts | 12 +- .../glazewm/create-glazewm-provider.ts | 4 +- .../komorebi/create-komorebi-provider.ts | 2 +- packages/client-api/src/shims.d.ts | 9 +- packages/client-api/src/user-config/index.ts | 1 - .../src/user-config/window-config.ts | 66 ------- .../client-api/src/utils/convert-bytes.ts | 76 -------- packages/client-api/src/utils/index.ts | 1 - .../client-api/src/zebar-context.model.ts | 109 ----------- packages/desktop/package.json | 2 +- packages/desktop/src/cli.rs | 37 ++-- packages/desktop/src/commands.rs | 27 +-- packages/desktop/src/config.rs | 131 ++++++------- packages/desktop/src/main.rs | 111 +++++------ packages/desktop/src/monitor_state.rs | 39 +--- .../desktop/src/providers/provider_manager.rs | 1 - packages/desktop/src/sys_tray.rs | 90 ++++----- .../{window_factory.rs => widget_factory.rs} | 181 +++++++++--------- resources/widget-schema.json | 136 +++++++++++++ 44 files changed, 715 insertions(+), 956 deletions(-) delete mode 100644 packages/client-api/src/desktop/current-window.ts delete mode 100644 packages/client-api/src/desktop/get-open-window-args.ts rename packages/client-api/src/desktop/{desktop-events.ts => provider-emit.ts} (93%) delete mode 100644 packages/client-api/src/desktop/shared/index.ts delete mode 100644 packages/client-api/src/desktop/shared/monitor-info.model.ts delete mode 100644 packages/client-api/src/desktop/shared/window-state.model.ts create mode 100644 packages/client-api/src/desktop/widgets.ts create mode 100644 packages/client-api/src/desktop/windows.ts delete mode 100644 packages/client-api/src/init.ts delete mode 100644 packages/client-api/src/user-config/index.ts delete mode 100644 packages/client-api/src/user-config/window-config.ts delete mode 100644 packages/client-api/src/utils/convert-bytes.ts delete mode 100644 packages/client-api/src/zebar-context.model.ts rename packages/desktop/src/{window_factory.rs => widget_factory.rs} (59%) create mode 100644 resources/widget-schema.json diff --git a/README.md b/README.md index ac2d1418..26eec28d 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ When Zebar is first launched, a set of default widget configs are generated to ` To create a new widget, simply copy its config file into the `%userprofile%/.glzr/zebar` directory. -Widgets are powered by native webviews (_similar_ to Electron, but less resource heavy). Every widget has its own config file and a corresponding HTML file for the markup and styling of the window. This is an ordinary HTML file, so any frontend framework (React, Angular, Vue, etc.) can be used. +Widgets are powered by native webviews (_similar_ to Electron, but less resource heavy). Every widget has its own config file and a corresponding HTML file for the markup and styling of the widget. This is an ordinary HTML file, so any frontend framework (React, Angular, Vue, etc.) can be used. Zebar exposes various system information (refered to as "providers") which can be used and displayed by your frontend. This includes stats like CPU usage, battery info, various window manager integrations, and lots more. @@ -134,7 +134,7 @@ No config options. | `allWorkspaces` | Workspaces across all monitors. | `Workspace[]` | microsoft icon | | `allMonitors` | All monitors. | `Monitor[]` | microsoft icon | | `focusedMonitor` | Monitor that currently has focus. | `Monitor` | microsoft icon | -| `currentMonitor` | Monitor that is nearest to this Zebar window. | `Monitor` | microsoft icon | +| `currentMonitor` | Monitor that is nearest to this Zebar widget. | `Monitor` | microsoft icon | | `focusedContainer` | Container that currently has focus (on any monitor). | `Container` | microsoft icon | | `tilingDirection` | Tiling direction of the focused container. | `TilingDirection` | microsoft icon | | `bindingModes` | Active binding modes; | `BindingModeConfig[]` | microsoft icon | @@ -268,7 +268,7 @@ No config options. | `allWorkspaces` | Workspaces across all monitors. | `KomorebiWorkspace[]` | microsoft icon | | `allMonitors` | All monitors. | `KomorebiMonitor[]` | microsoft icon | | `focusedMonitor` | Monitor that currently has focus. | `KomorebiMonitor` | microsoft icon | -| `currentMonitor` | Monitor that is nearest to this Zebar window. | `KomorebiMonitor` | microsoft icon | +| `currentMonitor` | Monitor that is nearest to this Zebar widget. | `KomorebiMonitor` | microsoft icon | ### Weather diff --git a/examples/boilerplates/react-buildless/index.html b/examples/boilerplates/react-buildless/index.html index 67fad032..8c8595bb 100644 --- a/examples/boilerplates/react-buildless/index.html +++ b/examples/boilerplates/react-buildless/index.html @@ -24,11 +24,9 @@