You are not logged in.
Pages: 1
I'm using a couple of genmons on my xfce panel to display some basic system info to the right of my clock (see image):
I'm wondering, however, if there's a way to change the colour of the fonts. I've tried quite a few things to no avail. Any ideas? You can see the scripts for each below for reference:
#!/usr/bin/perl
# stats.pl - returns CPU and RAM usage
# CPU stuff
my $cpuusage = `top -bn 2 -d 0.2 | grep '^%Cpu' | tail -n 1 | gawk '{print \$2+\$4+\$6}'`;
chomp $cpuusage;
$cpuusage =~ s/^([0-9][0-9]*)(\.[0-9][0-9]*)$/$1/;
printf "CPU: %02d%% ","$cpuusage";
# RAM stuff
my $total = `grep -e "^MemTotal" -m 1 /proc/meminfo`;
$total =~ s/([^0-9]*)([0-9]*)(.*)$/$2/;
my $available = `grep -e "^MemAvailable" -m 1 /proc/meminfo`;
$available =~ s/([^0-9]*)([0-9]*)(.*)$/$2/;
my $memusage = 100 - ($available / $total * 100);
printf "RAM: %02d%%\n","$memusage";
#!/usr/bin/perl
# stats.pl - returns CPU and RAM usage
# CPU stuff
my $cpuusage = `top -bn 2 -d 0.2 | grep '^%Cpu' | tail -n 1 | gawk '{print \$2+\$4+\$6}'`;
chomp $cpuusage;
$cpuusage =~ s/^([0-9][0-9]*)(\.[0-9][0-9]*)$/$1/;
printf "CPU: %02d%% ","$cpuusage";
# RAM stuff
my $total = `grep -e "^MemTotal" -m 1 /proc/meminfo`;
$total =~ s/([^0-9]*)([0-9]*)(.*)$/$2/;
my $available = `grep -e "^MemAvailable" -m 1 /proc/meminfo`;
$available =~ s/([^0-9]*)([0-9]*)(.*)$/$2/;
my $memusage = 100 - ($available / $total * 100);
printf "RAM: %02d%%\n","$memusage";
I'd really appreciate some help :-)
Last edited by deanr (2021-05-03 20:11:09)
Offline
If you want all genmon script labels to change to the same color, add to ~/.config/gtk3.0/gtk.css the following:
.genmon_value { color: red }
If you want to effect just one genmon instance, find it's ID (hover over the item in the Panel Properties > Items tab, and use something like:
#genmon-4 .genmon_value { color: red }
...where "4" is the ID you need to change.
The genmon plugin also supports Pango Markup so something like (using a bash shell):
echo "<txt><span foreground='#FF0000'> $cpuusage </span></txt>"
...will work. I'm not sure how to do this using a perl script, though.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Genius!
Just for the record, I added the following to ~/.config/gtk3.0/gtk.css:
#genmon-9 .genmon_value { color: #B68E6B }
#genmon-8 .genmon_value { color: #DF5B35 }
#genmon-5 .genmon_value { color: #E1C3CB }
with the result being:
Thanks a million for your help, ToZ.
Offline
Pages: 1
[ Generated in 0.008 seconds, 8 queries executed - Memory usage: 524.59 KiB (Peak: 525.88 KiB) ]