Skip to content

Instantly share code, notes, and snippets.

@bfrancom
Created March 3, 2017 21:29
Show Gist options
  • Save bfrancom/bb396368688c7dabd6b8a5b42d5c5883 to your computer and use it in GitHub Desktop.
Save bfrancom/bb396368688c7dabd6b8a5b42d5c5883 to your computer and use it in GitHub Desktop.
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