New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

i3-status-node

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i3-status-node

A simple NodeJS status bar for i3wm that supports colour.

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

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.

// ~/.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

// ~/.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. Using the IPC format allows for advanced usage such as printing in colour or suppressing the separator.

// ~/.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 
}
...

Keywords

i3

FAQs

Package last updated on 11 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts