You are not logged in.
Hi there,
I have a perl script that I use to display some useful information through xsetroot.
while true
do
xsetroot -name "$(perl /home/francis/bin/status.pl)"
sleep 30
done &I've applied the statuscolors patch and tried to add colour to my status bar, but I'm having problems with it. Using the \x0[1-9] color codes results in whitespace added to the output. Is there a way to eliminate this? Code and examples follow.
// perl code
if($cpu>=200){
$col="\x05";
}
elsif($cpu>=100){
$col="\x04";
}
else{
$col="\x03";
}
$cpu='C'.$col.$cpu.'%';
// output
// output to console (correct but no color, of course)
C13%
// output to status bar (two spaces! and color)
C 13%Also, for some reason I do not understand, I am only able to switch between the normal and the selected colors, even when I hard code \x04 or \x05.
#define NUMCOLORS 5
static const char colors[NUMCOLORS][ColLast][8] = {
// border foreground background
{ "#383838", "#d0d0d0", "#262729" }, // normal
{ "#383838", "#ff9500", "#262729" }, // selected
{ "#383838", "#00ff00", "#262729" }, // fine
{ "#383838", "#ffff00", "#262729" }, // warning
{ "#383838", "#ff0000", "#262729" }, // error
};Thanks
Last edited by One (2011-07-09 20:40:46)
First time Archer
Offline
This statuscolours patch fixes the whitespace issue http://lists.suckless.org/dev/1011/6445.html
dwm 5.9 comes out today, which means the patch will need slight tweaking...
# edit: you don't seem to have sufficient colours defined: numbering starts at 0
Offline
Thank you, Jason, for the statuscolors patch. That issue is now solved.
However, I'm still stuck with 2 colours: normal and selected. Which numbering are you referring to? Why would I not have enough colours defined?
(I'll wait a while for dwm 5.9 - I'll need help with applying multiple patches...)
First time Archer
Offline
$col="\x05";
And, as far as I can count, you only have defined \x{0-4}
Offline
AFAIK numbering starts at \x01 ( http://dwm.suckless.org/patches/statuscolors ), so it _should_ work.
But even if you were right, I should be able to produce 4 of my 5 colours. I can only get 2 now.
First time Archer
Offline
This issue persists with the 6.1 statuscolors patch but as far as I can tell the code in drw_get_width() is designed to remove the whitespace. I'm having a lot of trouble fixing this myself ),:
Last edited by jgr (2016-01-12 17:20:32)
Offline