Skip to content

Instantly share code, notes, and snippets.

@bfrancom
Created March 3, 2017 21:29
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
OpenBSD Volume Percentage for Conky
//Node.js script which calculates OpenBSD Volume percentage for the master output
//Only calculates the right channel, and assumes both channels are equal
//I use this with i3 + i3bar + conky
const spawn = require('child_process').spawn;
const mixerctl = spawn('mixerctl', ['-v', 'outputs.master']);
mixerctl.stdout.on('data', (data) => {
var arr = data.toString().split(",");
var lastNum = arr[1].replace(/(\r\n|\n|\r)/gm,"");
var perc = (lastNum/226*100);
var wholeNum = Math.floor(perc);
console.log(wholeNum);
});
@bfrancom
Copy link
Author

bfrancom commented Mar 3, 2017

Screenshot of the i3bar:
2017-03-03_14_41_46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment