1

i3status-anyevent: move cpu mon file location, color and background color to config

This commit is contained in:
Sergei Fedosov
2021-02-20 20:28:42 +03:00
parent 217a86ecff
commit ccf477bc65
2 changed files with 17 additions and 10 deletions

View File

@@ -162,16 +162,16 @@ sub add_events () {
}
}
if ($CONF->{cpu_temp}) {
push @{$OUTPUT}, { color => '#3e78fd', full_text => $cputemp };
if ($CONF->{cpu_temp}->{enabled}) {
push @{$OUTPUT}, { color => $CONF->{color}, full_text => $cputemp };
}
if ($CONF->{mem}) {
push @{$OUTPUT}, { color => '#3e78fd', full_text => $meminfo };
push @{$OUTPUT}, { color => $CONF->{color}, full_text => $meminfo };
}
if ($CONF->{la}) {
push @{$OUTPUT}, { color => '#3e78fd', full_text => "LA: $la" };
push @{$OUTPUT}, { color => $CONF->{color}, full_text => "LA: $la" };
}
my $vpn_str = 'VPN:';
@@ -197,11 +197,11 @@ sub add_events () {
}
if ($CONF->{vpn}->{tcp_check}->{enabled} || $CONF->{vpn}->{enabled}) {
push @{$OUTPUT}, { color => '#3e78fd', full_text => $vpn_str };
push @{$OUTPUT}, { color => $CONF->{color}, full_text => $vpn_str };
}
if ($CONF->{battery}->{enabled}) {
push @{$OUTPUT}, { color => '#3e78fd', full_text => $charge };
push @{$OUTPUT}, { color => $CONF->{color}, full_text => $charge };
}
if ($CONF->{clock}->{enabled}) {
@@ -489,19 +489,19 @@ sub add_events () {
}
# populate cpu temperature info
if ($CONF->{cpu_temp}) {
if ($CONF->{cpu_temp}->{enabled}) {
my $hwmon = 1;
if (defined $CPUTEMPHANDLE) {
if (tell $CPUTEMPHANDLE == -1) {
if (open $CPUTEMPHANDLE, '<', '/sys/class/hwmon/hwmon0/temp1_input') {
if (open $CPUTEMPHANDLE, '<', $CONF->{cpu_temp}->{file}) {
$hwmon = 1;
} else {
$hwmon = 0;
}
}
} else {
unless (open $CPUTEMPHANDLE, '<', '/sys/class/hwmon/hwmon0/temp1_input') {
unless (open $CPUTEMPHANDLE, '<', $CONF->{cpu_temp}->{file}) {
$hwmon = 0;
};
}

View File

@@ -1,5 +1,9 @@
# Enable "plugin" 1, disable "plugin" 0
{
# default text and background colors
"color" : "#3e78fd",
"background" : "#edeceb",
# Load Average
"la" : 1,
@@ -25,7 +29,10 @@
},
# 0-th core temperature
"cpu_temp": 1,
"cpu_temp": {
"enabled": 1,
"file": "/sys/class/hwmon/hwmon0/temp1_input"
},
# Caps Lock status
"capslock": {