Skip to content

Commit

Permalink
docs: add contributing info
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-berger committed Feb 3, 2024
1 parent 7863a49 commit 0363010
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 31 deletions.
36 changes: 35 additions & 1 deletion ARCHITECTURE.md → CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,55 @@
# Contributing to Zebar

Zebar uses the Tauri desktop framework and requires Node.js + Rust.

Rust **nightly** and Node.js **version 20** are currently used.

### Installing Rust

[`rustup`](https://rustup.rs/) is the recommended way to set up the Rust toolchain.

### Installing Node.js

Install Node.js via the [official download](https://nodejs.org/en/download) or a version manager like NVM ([unix](https://github.com/nvm-sh/nvm#installing-and-updating), [windows](https://github.com/coreybutler/nvm-windows?tab=readme-ov-file#overview)), or [pnpm via its standalone script](https://pnpm.io/installation#using-a-standalone-script) and then switching version via `pnpm env use -g 20`.

### Development

To start the project in development mode:

```shell
# Install pnpm (package manager) if not already installed.
npm i -g pnpm

# Install dependencies.
pnpm i

# Start in development mode.
pnpm dev
```

## Architecture

Zebar is split into 3 packages:

- `desktop` - a Tauri app which is a CLI that can spawn windows.
- `client` - a SolidJS frontend which is spawned by Tauri on `zebar open <window_name>`.
- `client-api` - business logic for communicating with Tauri.

# How to create a new provider?
### How to create a new provider?

1. **Create a new config schema for your provider.**

1. Add a schema for the config under [`packages/client-api/src/user-config/window/providers`](https://github.com/glzr-io/zebar/tree/main/packages/client-api/src/user-config/window/providers).
2. Add the new provider type to the [`ProviderType`](https://github.com/glzr-io/zebar/blob/main/packages/client-api/src/user-config/window/provider-type.model.ts) enum.
3. Add the schema to the [`ProviderConfigSchema`](https://github.com/glzr-io/zebar/blob/main/packages/client-api/src/user-config/window/provider-config.model.ts) array.

2. **Add the client-side logic for the provider.** Most providers aren't client-side heavy, and simply subscribe to some variables sent from the Tauri backend (eg. [`create-ip-provider.ts`](https://github.com/glzr-io/zebar/tree/main/packages/client-api/src/providers/ip/create-ip-provider.ts)).

1. Add a new provider under [`packages/client-api/src/providers`](https://github.com/glzr-io/zebar/tree/main/packages/client-api/src/providers).
2. Add the provider to the switch statement in [`createProvider(...)`](https://github.com/glzr-io/zebar/blob/main/packages/client-api/src/providers/create-provider.ts#L28).

3. **Add the backend logic for the provider.**

1. Add the logic for the provider under [`packages/desktop/src/providers`](https://github.com/glzr-io/zebar/tree/main/packages/desktop/src/providers).
2. Add the provider's config to the [`ProviderConfig`](https://github.com/glzr-io/zebar/blob/main/packages/desktop/src/providers/config.rs) enum.
3. Add the provider's variables to the [`ProviderVariables`](https://github.com/glzr-io/zebar/blob/main/packages/desktop/src/providers/variables.rs) enum.
Expand Down
35 changes: 5 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,16 @@

Zebar is a way to create customizable and cross-platform taskbars, desktop widgets, and popups.

## Contributing

Zebar uses the Tauri desktop framework and requires Node.js + Rust.

### Installing Rust

[`rustup`](https://rustup.rs/) is the recommended way to set up the Rust toolchain. It can be installed via:

```shell
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

### Installing Node.js

Install Node.js via [NVM](https://github.com/nvm-sh/nvm#installing-and-updating) (recommended for easily switching between Node.js versions) or the [official download](https://nodejs.org/en/download).

### Development

To start the project in development mode:

```shell
# Install pnpm (package manager) if not already installed.
npm i -g pnpm

# Install dependencies.
pnpm i

# Start in development mode.
pnpm dev
```
[How to contribute](https://github.com/glzr-io/zebar/blob/main/CONTRIBUTING.md)

## Providers

### Battery

## Date

https://moment.github.io/luxon/#/formatting?id=table-of-tokens

### Host

- `hostname` -
Expand Down

0 comments on commit 0363010

Please sign in to comment.