0

Use pictogram from config for simple-volume-pa plugin

This commit is contained in:
Sergei Fedosov
2021-07-19 18:38:24 +03:00
parent f63dba554c
commit fba1d3dc5d
2 changed files with 11 additions and 5 deletions

View File

@@ -683,7 +683,7 @@ sub add_events () {
}
# poll pulseaudio volume on first sink in list
if ($CONF->{'simple-volume-pa'}) {
if ($CONF->{'simple-volume-pa'}->{enabled}) {
push @EP, AnyEvent->timer (
after => 0, # first invoke ASAP
interval => 1, # then invoke every 1 second
@@ -697,12 +697,15 @@ sub add_events () {
foreach my $str (split /\n/, $pactl) {
if ($str =~ /^\s+Volume\:\s+[a-z|A-Z\\-]+\:\s+\d+\s+\/\s+(\d+)% /xms ) {
my $volumestr = sprintf '<big>%s</big> %s%%', $CONF->{'simple-volume-pa'}->{symbol}, $1;
if (! defined $O->{'simple-volume-pa'}->{'full_text'}) {
$O->{'simple-volume-pa'}->{'full_text'} = $1;
$O->{'simple-volume-pa'}->{'full_text'} = $volumestr;
$O->{'simple-volume-pa'}->{'color'} = '#3e78fd';
$O->{'simple-volume-pa'}->{'markup'} = 'pango';
$UPDATE = 1;
} elsif ($O->{'simple-volume-pa'}->{'full_text'} ne $1) {
$O->{'simple-volume-pa'}->{'full_text'} = $1;
} elsif ($O->{'simple-volume-pa'}->{'full_text'} ne $volumestr) {
$O->{'simple-volume-pa'}->{'full_text'} = $volumestr;
$UPDATE = 1;
}

View File

@@ -70,7 +70,10 @@
# Simplified volume indicator
# it periodically polls pulseaudio via "pactl list sinks" command
# so it's not light on system resources as i'd like
"simple-volume-pa": 0,
"simple-volume-pa": {
"enabled": 0,
"symbol": "🎶"
},
"net-if" : {
"enabled" : 0,