Skip to content

Latest commit

 

History

History
93 lines (59 loc) · 4.12 KB

File metadata and controls

93 lines (59 loc) · 4.12 KB

Contributing guide

PRs are always a huge help 💛. Check out issues marked as good first issue or help wanted to get started.

First fork, then clone the repo:

git clone git@github.com:your-username/zebar.git

If not already installed, install Rust and Node.js v20, then run:

# Install pnpm (package manager).
npm i -g pnpm

# Install dependencies.
pnpm i

# Start in development mode. (config: ~/.glzr/zebar/)
pnpm dev

After making your changes, push to your fork and submit a pull request. Please try to address only a single feature or fix in the PR so that it's easy to review.

Installing Rust

rustup is the de-facto way to set up the Rust toolchain.

Installing Node.js

Install Node.js via the official download or a version manager like NVM (download - works on Unix and WSL/Git Bash on Windows).

Architecture

Zebar is split into 2 packages:

  • desktop

A Tauri desktop application which acts as the backend for spawning and communicating with windows.

  • client-api

JS package for communicating with the Tauri backend. Published to npm as zebar.

How to create a new provider?

  1. Add the client-side logic for the provider. Most providers aren't client-side heavy, and simply subscribe to some outputs sent from the Tauri backend (eg. create-ip-provider.ts).

    1. Add a new provider under client-api/src/providers/<YOUR_PROVIDER>.
    2. Modify create-provider.ts to add the new provider to the ProviderConfigMap and ProviderMap types, and to create the provider in the switch statement within createProvider.
    3. Export the provider's types from client-api/src/providers/index.ts.
  2. Add the backend logic for the provider.

    1. Add the logic for the provider under desktop/src/providers/<YOUR_PROVIDER>.
    2. Add the provider's config to the ProviderConfig enum.
    3. Add the provider's outputs to the ProviderOutput enum.
    4. Add the provider to the switch statement in create_provider(...).
    5. Add the provider's exports to desktop/src/providers/mod.rs

Using local zebar NPM package

Just like in production, when running pnpm dev, Zebar will use the widgets found within your config directory (i.e. ~/.glzr/zebar/*). However, when developing locally, you may want to use a local zebar NPM package. To do so, run:

cd path/to/your/widget

# If using pnpm:
pnpm add --link ../../path/to/zebar/packages/client-api

# If using npm:
npm install ../../path/to/zebar/packages/client-api

This will create a symlink to the local zebar NPM package and results in a package.json similar to this:

{
  "dependencies": {
    "zebar": "link:../../repos/zebar/packages/client-api"
  }
}

Troubleshooting

MacOS: Settings UI using outdated dependencies

On MacOS, the settings UI may use cached versions of dependencies. To resolve this:

  1. Delete the packages/settings-ui/.vite directory
  2. Run pnpm dev again