https://github.com/pumpncode/anybar
Control AnyBar in Deno
https://github.com/pumpncode/anybar
Last synced: over 1 year ago
JSON representation
Control AnyBar in Deno
- Host: GitHub
- URL: https://github.com/pumpncode/anybar
- Owner: pumpncode
- License: mit
- Created: 2021-11-07T09:58:20.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-12-09T10:02:07.000Z (over 1 year ago)
- Last Synced: 2024-12-09T11:19:25.946Z (over 1 year ago)
- Language: JavaScript
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# anybar
Control [AnyBar](https://github.com/tonsky/AnyBar)
## Note
Requires the `--unstable` deno flag to be used.
## Usage
```js
import anybar from "https://x.nest.land/anybar@1.0.0/module.js";
anybar("red");
// This turns AnyBar menu bar dot red.
// 🔴
anybar("green", {anybar: 9876});
// AnyBar could run on a specific port.
// 🟢
anybar("blue", {anybar: 9876, deno: 54321});
// If this module needs to run on a specific port for some reason.
// 🔵
```
## API
### anybar(style, ports)
- Returns: A promise that resolves after the style got sent to AnyBar.
#### style
- Type: `string`
The [style](https://github.com/tonsky/AnyBar#usage) of the dot you want AnyBar to display.
#### ports
- Type: `object`
The port options.
##### ports.anybar
- Type: `number`
- Default: The value of the environment variable `ANYBAR_PORT` or, if that is undefined, `1738`, which is the default port number for AnyBar.
The UDP port AnyBar runs on.
##### ports.deno
- Type: `number`
- Default: The lowest free port number in the ["unassignable"](https://www.rfc-editor.org/rfc/rfc6335.html#section-8.1.2) range (`49152`-`65535`).
The port this module should use to communicate with AnyBar. Only numbers between 1024 and 65535 are allowed, anything else will throw a `RangeError`.
## Acknowledgments
This module, especially the API, was heavily inspired by the [node module for the same purpose](https://github.com/sindresorhus/anybar) by [sindresorhus](https://github.com/sindresorhus).