Skip to content

Instantly share code, notes, and snippets.

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

This comment has been minimized.

Copy link
Owner 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
You can’t perform that action at this time.