# i3-status-node

> A simple NodeJS status bar for i3wm that supports colour.

Latest version **0.0.1** (published 2016-11-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install i3-status-node
pnpm add i3-status-node
yarn add i3-status-node
bun add i3-status-node
```

Provides the command `i3-status-node`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2016-11-11 |
| First published | 2016-11-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Will Homer |
| Maintainers | will.homer |
| Keywords | i3, i3wm, status, bar |

## Links

- npm: https://www.npmjs.com/package/i3-status-node
- Repository: https://github.com/WillFour20/i3-status-node
- Homepage: https://github.com/WillFour20/i3-status-node#readme
- Issues: https://github.com/WillFour20/i3-status-node/issues
- npm.io page: https://npm.io/package/i3-status-node

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 0.0.1 (latest) — 2016-11-11

## README

# i3-status-node
A simple NodeJS status bar for i3wm that supports colour.
## How to use 
#### Installation
```
npm install -g i3-status-node
```
#### i3-status-node Configuration
Create a `.i3-status-node` folder in your home folder.

This folder must contain a file named `config.json` which describes the layout of your status bar
and script files that produce the output for each section of the status bar.

```javascript
// ~/.i3-status-node/config.json
{
    'separator_width': 15,
    'layout': [ 'kernel', 'diskusage' ]
}
```

A simple script that would display the kernel version would look like the following

```javascript
// ~/.i3-status-node/kernel.js
var cp = require("child_process"),
    exec = (cmd) => cp.execSync(cmd).toString().replace("\n", "");
    
module.exports = (update) => {
  update(exec("uname -r"));
};
```

The update function can be called with either a string or an object representing a 
[i3bar IPC message block](http://i3wm.org/docs/i3bar-protocol.html#_blocks_in_detail).
Using the IPC format allows for advanced usage such as printing in colour or suppressing the separator. 

```javascript
// ~/.i3-status-node/diskusage.js
var cp = require("child_process"),
    exec = (cmd) => cp.execSync(cmd).toString().replace("\n", "");
    
module.exports = (update) => {
  var updateTime = () => {
    var diskUsedStr = exec("df -hPl / | awk 'NR==2{print $5}'");
    var diskUsedPct = parseInt(diskUsedStr.substring(0, diskUsedStr.length - 1), 10);
    
    update({
      'full_text': diskUsedStr,
      'color': (diskUsedPct > 90) ? '#ff0000' : '#00ff00'
    });
    setTimeout(updateTime, 60 * 1000);
  }
  updateTime();
};
```

The update callback will also accept arrays containing multiple messages in a mixture of either format.
More example scripts can be found in the scripts folder. 

#### i3 Configuration

In the i3 config file change the `status_command` setting to `i3-status-node` like so:
```
// ~/.config/i3/config
...
bar {
  status_command i3-status-node 
}
...
```

---
_Source: https://npm.io/package/i3-status-node · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
