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

View File

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