polybar-helpers
Polybar - Helpers to create plugin/module using NodeJS
Last updated 2 years ago by tiagodanin .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install polybar-helpers 
SYNC missed versions from official npm registry.

Polybar-Helpers

Polybar - Helpers to create plugin/module using NodeJS

Installation

This is a Node.js module available through the npm registry. It can be installed using the npm or yarn command line tools.

npm install polybar-helpers --save

Usage

Config in polybar

; My Module
[module/test]
type = custom/script
exec = node App.js
click-left = echo left >> $HOME/.config/polybar/events
click-middle = echo middle >> $HOME/.config/polybar/events
click-right = echo right >> $HOME/.config/polybar/events
scroll-up = echo scrollUp >> $HOME/.config/polybar/events
scroll-down = echo scrollDown >> $HOME/.config/polybar/events
tail = true

App.js

const polybarHelpers = require('polybar-helpers')

polybarHelpers(
	(app) => {
		app.file('/home/tiago/.config/polybar/events')
		app.on(['left', 'right'], (ctx) => {
			console.log(ctx)
		})
		app.on('middle', (ctx) => {
			console.log(ctx)
			console.log(ctx.lastEvent) //return last event, e.g: left
		})
		app.on(['scrollUp', 'scrollDown'], (ctx) => {
			console.log(ctx)
			console.log(ctx.event) //return current event, e.g: scrollUp or scrollDown
		})
		app.error((msg, ctx) => {
			console.error(msg, ctx)
		})
	}
)

Dependencies

  • tail: tail a file in node

License

MIT

Current Tags

  • 1.0.2                                ...           latest (2 years ago)

3 Versions

  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (0)
None

Copyright 2014 - 2017 © taobao.org |