Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: V2 - framework integration #99

Merged
merged 138 commits into from
Sep 17, 2024
Merged
Changes from 1 commit
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
6312a17
feat: delete templating-related files; add `ZebarContext` interface
lars-berger Aug 21, 2024
ed455ea
feat: create/use existing reactive solidjs context
lars-berger Aug 21, 2024
a876f43
refactor: reorganize provider-related types
lars-berger Aug 21, 2024
5d4f9ba
feat: add new sample config
lars-berger Aug 22, 2024
9fb2e0a
feat: improve sample config
lars-berger Aug 22, 2024
6695a30
feat: remove start script
lars-berger Aug 22, 2024
2ad9a1e
feat: organize entry point depending on cli subcommand
lars-berger Aug 22, 2024
8d26110
feat: add window config serialization
lars-berger Aug 22, 2024
0f71642
feat: get rust to compile
lars-berger Aug 22, 2024
0bc3f20
feat: add provider configs alongside provider logic in client-api
lars-berger Aug 22, 2024
707e112
refactor: remove client app
lars-berger Aug 22, 2024
51cf0a9
feat: improvements to ts typing of provider fns
lars-berger Aug 22, 2024
ef0b375
feat: simplify ts typing of `createProvider`
lars-berger Aug 22, 2024
46107a1
feat: expose `createProvider` function on context
lars-berger Aug 22, 2024
624617f
feat: add init option to include default css
lars-berger Aug 23, 2024
f62094d
feat: aggregate configs found within config dir
lars-berger Aug 23, 2024
b35dc8a
feat: change config to camelCase; reorganize `resources` dir
lars-berger Aug 23, 2024
de6f2fc
chore: remove unused deps
lars-berger Aug 23, 2024
17208c7
refactor: rename `user_config` mod -> `config`
lars-berger Aug 23, 2024
31a836e
refactor: clean up config processing
lars-berger Aug 23, 2024
62b2d28
feat: evaluate settings file and init starter config if it doesn't exist
lars-berger Aug 23, 2024
eb128f9
feat: add `reload` fn; add generic `read_and_parse_json` fn
lars-berger Aug 23, 2024
f67baa5
refactor: move out fs helper functions to new `fs_util` mod
lars-berger Aug 23, 2024
d45fdeb
refactor: rename `util` mod -> `common`
lars-berger Aug 23, 2024
c31a76d
feat: avoid overwriting existing config files when initializing starter
lars-berger Aug 23, 2024
71ed01d
feat: progress on initializing window from config
lars-berger Aug 23, 2024
393b71c
feat: open window from local asset url
lars-berger Aug 23, 2024
cfafe80
feat: create `MonitorState` struct for holding monitor info
lars-berger Aug 26, 2024
97e8139
feat: initialize window with defaults from config
lars-berger Aug 26, 2024
01a547c
feat: add `canonicalize_pretty`; open custom html from window factory
lars-berger Aug 26, 2024
bdc9dfe
refactor: rename `monitors` mod -> `monitor_state`
lars-berger Aug 26, 2024
f837214
feat: add default `Empty` command if no cli subcommand is passed
lars-berger Aug 26, 2024
f9483ce
feat: conditionally open one or all windows on start
lars-berger Aug 26, 2024
3a06c42
refactor: clean up `setup` in tauri builder
lars-berger Aug 26, 2024
b8b20c5
refactor: create separate `commands` mod for tauri commands
lars-berger Aug 26, 2024
a36673f
feat: sort monitors left-to-right, top-to-bottom
lars-berger Aug 27, 2024
71d00e0
feat: add `MonitorSelection` struct
lars-berger Aug 27, 2024
1e47a0b
feat: change window open methods to be async
lars-berger Aug 27, 2024
6181158
feat: position windows according to their anchor point
lars-berger Aug 27, 2024
0c3e592
refactor: remove `open_all` method
lars-berger Aug 27, 2024
eac9af1
refactor: create `SysTray` struct
lars-berger Aug 27, 2024
c64358d
refactor: simplify initialization of `ProviderManager`
lars-berger Aug 27, 2024
7daebd5
feat: launch startup configs only
lars-berger Aug 27, 2024
06befd2
feat: format config paths in sys tray
lars-berger Aug 28, 2024
11b4b07
feat: add `MenuId` enum; wip menu for individual config items
lars-berger Aug 28, 2024
314c4d2
refactor: separate out systray menus into functions
lars-berger Aug 28, 2024
8b8eb0b
feat: show config menu with enable + launch on startup options
lars-berger Aug 28, 2024
664ea2d
refactor: improve error handling for menu events
lars-berger Aug 28, 2024
0037d75
feat: show active windows in system tray
lars-berger Aug 28, 2024
ada0d2d
refactor: remove `window_config_by_rel_path` in favor of new `join_path`
lars-berger Aug 28, 2024
6584031
feat: show whether config is enabled in sys tray
lars-berger Aug 28, 2024
3651e6c
refactor: move `app_handle`, `config`, and `window_factor` to state i…
lars-berger Aug 28, 2024
5b1791c
feat: change config state to be `Arc` + `Mutex`; listen to changes in…
lars-berger Aug 28, 2024
18fc928
feat: add changes channel on `WindowFactory`
lars-berger Aug 31, 2024
4630463
feat: add `examples` dir
lars-berger Aug 31, 2024
53527da
feat: improve solid-ts example
lars-berger Sep 1, 2024
21274bf
chore: add `.npmrc` for forcing examples to use local client-api
lars-berger Sep 1, 2024
0c8edc9
feat: be able to override config dir; use `examples` as default confi…
lars-berger Sep 1, 2024
e13bfab
feat: integrate zebar in `solidjs-ts` example
lars-berger Sep 1, 2024
00fd9c7
fix: change config structs to use camelCase
lars-berger Sep 1, 2024
3605c3b
feat: progress on figuring out a nice client-side api for creating pr…
lars-berger Sep 1, 2024
822bc6a
feat: add zod validation for provider configs
lars-berger Sep 2, 2024
4cfbc04
feat: remove solidjs reactivity from `createProviderListener`
lars-berger Sep 2, 2024
9c6f52f
feat: create `Deferred` utility class
lars-berger Sep 2, 2024
c61a588
feat: remove solidjs reactive context; change battery + cpu providers…
lars-berger Sep 2, 2024
6bf5e7b
feat: working solidjs-ts client
lars-berger Sep 2, 2024
958942e
feat: remove `client` package
lars-berger Sep 2, 2024
319e645
feat: wip implementation of generic `Provider` type
lars-berger Sep 2, 2024
45f5006
feat: add `createbaseProvider` function for handling provider emissio…
lars-berger Sep 2, 2024
39650c9
feat: remove `util` provider; export as fn instead
lars-berger Sep 2, 2024
6376dc3
feat: remove `createProviderListener`; modify `onProviderEmit` to be …
lars-berger Sep 3, 2024
ef686d5
feat: update all providers to use `createBaseProvider`
lars-berger Sep 3, 2024
feb8bf5
feat: implement provider restart; rename `shutdown` -> `destroy`
lars-berger Sep 3, 2024
de94b65
feat: change window configs to require `.zebar.json` extension
lars-berger Sep 3, 2024
919bf47
refactor: separate out setup for single instance
lars-berger Sep 4, 2024
a2e402e
feat: remove solid-js dep in client-api
lars-berger Sep 5, 2024
e6259c2
feat: rename `value`/`onValue` -> `output`/`onOutput`
lars-berger Sep 5, 2024
589c986
feat: format config path without `.zebar.json` suffix
lars-berger Sep 5, 2024
2b5d301
feat: remove `glazewm` from solidjs-ts example
lars-berger Sep 5, 2024
e3b91fe
refactor: remove `refresh` and `stop` channels; call methods on provi…
lars-berger Sep 5, 2024
95be10e
refactor: remove `IntervalProvider` trait; remove `ProviderManager::i…
lars-berger Sep 5, 2024
b7b8759
refactor: variable renames
lars-berger Sep 5, 2024
18160d9
feat: change all providers to implement new `Provider` trait
lars-berger Sep 5, 2024
b75e9ca
fix: type errors
lars-berger Sep 6, 2024
7a081f2
feat: add back stop/refresh channels; remove Arc<Self> usage; simplif…
lars-berger Sep 6, 2024
72205d3
feat: wip shared interval provider impl
lars-berger Sep 6, 2024
74432eb
refactor: consume `impl_interval_provider` macro in all interval prov…
lars-berger Sep 6, 2024
bace18b
refactor: change provider mod to use its exports
lars-berger Sep 6, 2024
de3e666
feat: change provider creation to be infallible
lars-berger Sep 6, 2024
7aa9b98
feat: add output caching to provider ref
lars-berger Sep 6, 2024
17ae91f
feat: update system tray on window open/close; launch window on enable
lars-berger Sep 7, 2024
00806a6
refactor: change systray menu handling to be async
lars-berger Sep 7, 2024
6580e93
refactor: add `to_unicode_string` path ext
lars-berger Sep 7, 2024
607fd12
feat: add `strip_config_dir`; rename `join_path` -> `join_config_dir`
lars-berger Sep 7, 2024
8b40dda
feat: progress on implementing sys tray menu toggles
lars-berger Sep 7, 2024
d11bd69
feat: conditionally toggle system tray menu enable + launch on startup
lars-berger Sep 7, 2024
bed82f7
style: linting fixes
lars-berger Sep 7, 2024
5c7c23f
refactor: change config paths to be `PathBuf`'s instead of strings
lars-berger Sep 8, 2024
0c92b6d
feat: add `package.json` metadata for client api
lars-berger Sep 9, 2024
1878d2e
feat: add incomplete react-buildless example
lars-berger Sep 9, 2024
9f16721
feat: add working react-buildless example
lars-berger Sep 9, 2024
3c51983
chore: remove commonjs build
lars-berger Sep 9, 2024
bd4b069
feat: remove style injection; instead create style element manually
lars-berger Sep 9, 2024
043122a
chore: fix entrypoint after removing commonjs
lars-berger Sep 9, 2024
faef3b1
feat: use `examples/` dir as default window configs; add default star…
lars-berger Sep 9, 2024
9ee8cc8
feat: move boilerplates to `examples/boilerplates`
lars-berger Sep 9, 2024
26dcc88
feat: add `hasBattery` to battery output; change battery output prope…
lars-berger Sep 10, 2024
4a18909
feat: implement date provider formatting
lars-berger Sep 10, 2024
7f61cf0
feat: in default zebar styles, extend `body` to full viewport size
lars-berger Sep 10, 2024
65ad902
feat: add markup and styling for vanilla example
lars-berger Sep 10, 2024
969f61c
feat: remove default zebar styles; add modern normalize stylesheet
lars-berger Sep 11, 2024
1be2c60
feat: add glazewm and komorebi samples
lars-berger Sep 11, 2024
64b5968
feat: remove `toggleTilingDirection` and `focusWorkspace`; add onclic…
lars-berger Sep 11, 2024
b4f2d92
feat: revert `hasBattery` property on battery provider
lars-berger Sep 11, 2024
434a536
fix: prevent crash if failing to parse wifi hotspot ssid/signal strength
lars-berger Sep 11, 2024
5b411e2
feat: show network status in examples
lars-berger Sep 11, 2024
6813c30
feat: improve boilerplates
lars-berger Sep 11, 2024
14e241e
fix: remove starter config installation in wix config
lars-berger Sep 11, 2024
eb23361
feat: add helper message for running solid-ts example
lars-berger Sep 11, 2024
ff85b2c
feat: improve error messages of window config parse errors
lars-berger Sep 11, 2024
4d72e60
feat: change to windows subsystem
lars-berger Sep 11, 2024
0ae11d1
chore: add missing `Win32_System_Console` feature
lars-berger Sep 11, 2024
16cde9e
fix: prevent terminal from showing on `netsh` command
lars-berger Sep 11, 2024
8287e32
feat: queue client connection error from glazewm provider
lars-berger Sep 11, 2024
4b54b53
refactor: remove config reload test
lars-berger Sep 11, 2024
470c058
chore: bump `glazewm` dep to latest
lars-berger Sep 11, 2024
ff48587
fix: change `wifi_hotspot` to compile on all platforms
lars-berger Sep 12, 2024
45be431
feat: add `createProviderGroup` method on ctx
lars-berger Sep 12, 2024
a5ba453
feat: improve doc comments on `ZebarContext`
lars-berger Sep 13, 2024
fdd983f
feat: use `createProviderGroup` in examples
lars-berger Sep 13, 2024
c0e4047
feat: v2 - added scale_factor to the window_factory (#101)
CtByte Sep 13, 2024
71ced0b
fix: handle constrained window size on initial launch
lars-berger Sep 13, 2024
01541ac
feat: implement config reloading; add option to tray menu
lars-berger Sep 15, 2024
51a58df
feat: relaunch windows on display setting changes
lars-berger Sep 15, 2024
6decc2e
fix: skip missed tickets in interval provider
lars-berger Sep 15, 2024
46bc6e5
feat: progress on byte formatting of network provider
lars-berger Sep 16, 2024
6e7a0ea
feat: add formatted network traffic measure
lars-berger Sep 16, 2024
bbe0229
chore: remove unused tauri capability permissions
lars-berger Sep 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: improve boilerplates
lars-berger committed Sep 11, 2024
commit 6813c300d392042bb53a29e3fc7701cff919f94d
46 changes: 33 additions & 13 deletions examples/boilerplates/react-buildless/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<html>
<body>
<div id="root"></div>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="stylesheet" type="text/css" href="../../normalize.css" />
<link rel="stylesheet" type="text/css" href="./styles.css" />
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script src="https://ga.jspm.io/npm:es-module-shims@1.7.0/dist/es-module-shims.js"></script>
<script type="importmap">
@@ -13,6 +17,9 @@
}
}
</script>
</head>
<body>
<div id="root"></div>

<script type="text/babel" data-type="module">
import React, { useState, useEffect } from 'react';
@@ -39,19 +46,32 @@
});

useEffect(() => {
cpu.onOutput(cpu => setOutputs({ ...outputs, cpu }));
battery.onOutput(battery => setOutputs({ ...outputs, battery }));
memory.onOutput(memory => setOutputs({ ...outputs, memory }));
weather.onOutput(weather => setOutputs({ ...outputs, weather }));
cpu.onOutput(cpu =>
setOutputs(outputs => ({ ...outputs, cpu })),
);
battery.onOutput(battery =>
setOutputs(outputs => ({ ...outputs, battery })),
);
memory.onOutput(memory =>
setOutputs(outputs => ({ ...outputs, memory })),
);
weather.onOutput(weather =>
setOutputs(outputs => ({ ...outputs, weather })),
);
}, []);

return (
<div>
cpu: {outputs.cpu.usage}
battery: {outputs.battery?.chargePercent}
memory: {outputs.memory.usage}
weather temp: {outputs.weather.celsiusTemp}
weather status: {outputs.weather.status}
<div className="app">
<div className="chip">CPU usage: {outputs.cpu.usage}</div>
<div className="chip">
Battery charge: {outputs.battery?.chargePercent}
</div>
<div className="chip">
Memory usage: {outputs.memory.usage}
</div>
<div className="chip">
Weather temp: {outputs.weather?.celsiusTemp}
</div>
</div>
);
}
2 changes: 1 addition & 1 deletion examples/boilerplates/react-buildless/my-window.zebar.json
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
"offsetX": "0px",
"offsetY": "0px",
"width": "100%",
"height": "50px",
"height": "40px",
"monitorSelection": {
"type": "all"
}
23 changes: 23 additions & 0 deletions examples/boilerplates/react-buildless/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
body {
color: rgb(255 255 255 / 90%);
font-family: ui-monospace, monospace;
font-size: 12px;
}

html,
body,
#root {
height: 100%;
}

.app {
text-align: center;
}

.chip {
display: inline-block;
padding: 4px 8px;
border-radius: 4px;
background: rgb(84, 66, 220);
margin-right: 4px;
}
20 changes: 3 additions & 17 deletions examples/boilerplates/solid-ts/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
## Usage

Those templates dependencies are maintained via [pnpm](https://pnpm.io) via `pnpm up -Lri`.

This is the reason you see a `pnpm-lock.yaml`. That being said, any package manager will work. This file can be safely be removed once you clone a template.

```bash
$ npm install # or pnpm install or yarn install
```
@@ -14,23 +10,13 @@ $ npm install # or pnpm install or yarn install

In the project directory, you can run:

### `npm run dev` or `npm start`

Runs the app in the development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
### `npm run dev`

The page will reload if you make edits.<br>
Runs the app in the development mode.

### `npm run build`

Builds the app for production to the `dist` folder.<br>
It correctly bundles Solid in production mode and optimizes the build for the best performance.
It bundles Solid in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!

## Deployment

You can deploy the `dist` folder to any static host provider (netlify, surge, now, etc.)

## This project was created with the [Solid CLI](https://solid-cli.netlify.app)
3 changes: 2 additions & 1 deletion examples/boilerplates/solid-ts/index.html
Original file line number Diff line number Diff line change
@@ -5,10 +5,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<title>Zebar</title>
<link rel="stylesheet" type="text/css" href="../../normalize.css" />
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script src="/src/index.tsx" type="module"></script>
<script src="./src/index.tsx" type="module"></script>
</body>
</html>
6 changes: 3 additions & 3 deletions examples/boilerplates/solid-ts/my-window.zebar.json
Original file line number Diff line number Diff line change
@@ -10,10 +10,10 @@
"placements": [
{
"anchor": "top_left",
"offsetX": "20px",
"offsetY": "20px",
"offsetX": "0px",
"offsetY": "0px",
"width": "100%",
"height": "30px",
"height": "40px",
"monitorSelection": {
"type": "all"
}
20 changes: 20 additions & 0 deletions examples/boilerplates/solid-ts/src/index.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
body {
color: rgb(255 255 255 / 90%);
font-family: ui-monospace, monospace;
font-size: 12px;
}

html,
body,
#root {
height: 100%;
}

.app {
text-align: center;
}

.chip {
display: inline-block;
padding: 4px 8px;
border-radius: 4px;
background: rgb(84, 66, 220);
margin-right: 4px;
}
24 changes: 13 additions & 11 deletions examples/boilerplates/solid-ts/src/index.tsx
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import { createStore } from 'solid-js/store';
import { init } from 'zebar';

const zebarCtx = await init();

const [cpu, battery, memory, weather] = await Promise.all([
zebarCtx.createProvider({ type: 'cpu' }),
zebarCtx.createProvider({ type: 'battery' }),
@@ -15,25 +16,26 @@ const [cpu, battery, memory, weather] = await Promise.all([
render(() => <App />, document.getElementById('root')!);

function App() {
const [store, setStore] = createStore({
const [outputs, setOutputs] = createStore({
cpu: cpu.output,
battery: battery.output,
memory: memory.output,
weather: weather.output,
});

cpu.onOutput(cpu => setStore({ cpu }));
battery.onOutput(battery => setStore({ battery }));
memory.onOutput(memory => setStore({ memory }));
weather.onOutput(weather => setStore({ weather }));
cpu.onOutput(cpu => setOutputs({ cpu }));
battery.onOutput(battery => setOutputs({ battery }));
memory.onOutput(memory => setOutputs({ memory }));
weather.onOutput(weather => setOutputs({ weather }));

return (
<div>
cpu: {store.cpu.usage}
battery: {store.battery?.chargePercent}
memory: {store.memory.usage}
weather temp: {store.weather.celsiusTemp}
weather status: {store.weather.status}
<div class="app">
<div class="chip">CPU usage: {outputs.cpu.usage}</div>
<div class="chip">
Battery charge: {outputs.battery?.chargePercent}
</div>
<div class="chip">Memory usage: {outputs.memory.usage}</div>
<div class="chip">Weather temp: {outputs.weather?.celsiusTemp}</div>
</div>
);
}