Xfce Forum

Sub domains
 

You are not logged in.

#1 2021-05-03 20:10:25

deanr
Member
Registered: 2021-04-08
Posts: 15

genmon font colours??

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):

https://imgur.com/kFJIDgD


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

#2 2021-05-03 20:43:43

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,482

Re: genmon font colours??

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

#3 2021-05-04 09:36:49

deanr
Member
Registered: 2021-04-08
Posts: 15

Re: genmon font colours??

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:

2XS4OUj.png


Thanks a million for your help, ToZ.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.008 seconds, 8 queries executed - Memory usage: 524.59 KiB (Peak: 525.88 KiB) ]