├── README.md ├── _config.yml ├── bin └── nanybar ├── lib └── index.js └── package.json /README.md: -------------------------------------------------------------------------------- 1 | # nanybar 2 | 3 | Control [AnyBar](https://github.com/tonsky/AnyBar) from the command line or from your javascript code 4 | 5 | ## Install 6 | 7 | **You must have [AnyBar](https://github.com/tonsky/AnyBar) installed and running** 8 | 9 | The usual : 10 | ``` 11 | npm install nanybar -g 12 | ``` 13 | 14 | ## Usage 15 | 16 | From the command line : 17 | 18 | ``` 19 | nanybar red 20 | ``` 21 | 22 | Or if [AnyBar](https://github.com/tonsky/AnyBar) is on another port : 23 | 24 | ``` 25 | nanybar yellow 1025 26 | ``` 27 | 28 | Or use it as a library : 29 | ```javascript 30 | var nanybar = require('nanybar'); 31 | 32 | nanybar('red'); 33 | nanybar('yellow', 1025); 34 | ``` 35 | 36 | ## License 37 | 38 | [MIT](http://rumpl.mit-license.org) 39 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /bin/nanybar: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var nanybar = require('../lib'); 4 | 5 | nanybar(process.argv[2], process.argv[3]); 6 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | var dgram = require('dgram'); 2 | 3 | module.exports = function (command, port) { 4 | var port = port || 1738; 5 | var host = '127.0.0.1'; 6 | var message = new Buffer(command); 7 | 8 | var client = dgram.createSocket('udp4'); 9 | client.send(message, 0, message.length, port, host, function(err, bytes) { 10 | client.close(); 11 | }); 12 | } 13 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nanybar", 3 | "description": "Control AnyBar from your node scripts", 4 | "version": "1.0.2", 5 | "author": "Djordje Lukic", 6 | "bin": { 7 | "nanybar": "bin/nanybar" 8 | }, 9 | "bugs": { 10 | "url": "https://github.com/rumpl/nanybar/issues", 11 | "email": "lukic.djordje@gmail.com" 12 | }, 13 | "homepage": "https://github.com/rumpl/nanybar", 14 | "keywords": [ 15 | "AnyBar", 16 | "MacOS" 17 | ], 18 | "license": "MIT", 19 | "main": "lib/index.js", 20 | "repository": { 21 | "type": "git", 22 | "url": "git://github.com/rumpl/nanybar.git" 23 | } 24 | } 25 | --------------------------------------------------------------------------------