Created
March 3, 2017 21:29
-
-
Save bfrancom/bb396368688c7dabd6b8a5b42d5c5883 to your computer and use it in GitHub Desktop.
OpenBSD Volume Percentage for Conky
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Screenshot of the i3bar: