Skip to content

Custom module is not updating #3046

Closed Answered by fredx100
fredx100 asked this question in Q&A
Discussion options

You must be logged in to vote

I have a working solution and so can guess at reasons!

The working solution is

#!/bin/bash

set -e

createJson(){
    amixer get Master |
        grep 'Mono:' |
        sed -nre 's/.*\[(.*)%\].*\[off\].*/\{"text": "\1% x", "class": "muted", "percentage": \1\}/p'\
            -e   's/.*\[(.*)%\].*/\{"text": "\1%  ", "class": "unmuted", "percentage": \1\}/p'
}

createJson
while read line; do
    createJson
done < <( /usr/sbin/alsactl monitor )

This reads one line at a time of the output from alsactl, pumping the relevant info from amixer each time (and ignoring the line from alsactl). I also tweaked the sed line so that you could still see the volume when it was muted, but that's just co…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ordy
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by fredx100
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants