Re: [dev] dwm xsetroot colorful fonts howto?

From: Kobi <dev.c0b1_AT_gmail.com>
Date: Sat, 14 May 2011 17:15:24 +0200

On 14-05-2011, 17:08:00 Le Tian <tianeast_AT_gmail.com> wrote:

> On Sat, May 14, 2011 at 1:52 PM, Le Tian <tianeast_AT_gmail.com> wrote:
>
>>
>>
>> On Sat, May 14, 2011 at 6:45 AM, Anders Andersson
>> <pipatron_AT_gmail.com>wrote:
>>
>>> On Fri, May 13, 2011 at 11:11 PM, Bogdan IonuČ› <bogdan_AT_punctweb.ro>
>>> wrote:
>>> > On Sat, May 14, 2011 at 00:01, Le Tian <tianeast_AT_gmail.com> wrote:
>>> >>
>>> >> I'm sorry, maybe its been discussed like a lot of times, but can
>>> anybody
>>> >> tell me how to color taskbar fonts in dwm? There is a patch
>>> >> (http://dwm.suckless.org/patches/statuscolors) but that I don't
>>> like,
>>> I need
>>> >> fonts to be colored not a colorful bg or fg in the taskbar, and
>>> maybe
>>> its
>>> >> possible to change the colors on-the-fly (when monitoring high CPU
>>> temps)?
>>> >> Maybe somebody has it implemented already.
>>> >>
>>> >> --
>>> >> Tian
>>>
>>> Why don't you set something up that throttles the CPU and eventually
>>> turns it off in case it gets too hot? What use is there to show the
>>> temperature on the status bar? Will the computer break if you're not
>>> there to turn it off in case it gets too hot?
>>>
>>> I just think things like this ruins the clean experience that dwm is.
>>>
>>>
>> cpu temp is not that useful, its agreeable, when hdd temp is very
>> useful,
>> its crucial for laptop users like me to keep their hdd temperature under
>> proper control. If I was using a desktop pc, I wouldn't bother myself
>> with
>> these tweaks, but as long as summer is coming, I think it come useful
>> for my
>> laptop.
>>
>> --
>> Tian
>>
>> Hi again, I managed to color taskbar output, but I need the cpu values
>> to
> be colored on-the-fly, so when my temp is more than 50C then the values
> should be red etc. can somebody help me to correct my script?
> I understand that I must add a "if else" condition, but it doesn't work,
> when I do, simply because I don't know correct syntax, and try to learn
> on-the-fly).
>
> here is my original script:
> ***********
> while true
> do
>
> cpu_temp=$(cat /proc/acpi/ibm/thermal | awk '{printf("\x04 cpu: "$3"*"$4"
> ")}')
>
> root_vol=$(df -h / | awk 'END {printf("\x01| root: "$5)}' | sed
> 's/Use%//')
> home_vol=$(df -h /home| awk 'END {printf("\x01home: "$5)}' | sed
> 's/Use%//')
> vol=$(aumix -q | awk '/vol/ {printf("\x01|\x03vol:"$3)}')
> date=$(date | awk 'END {printf("\x01| \x01"$1" "$2" "$3)}')
> uptime=$(uptime | awk 'BEGIN {FS = ":"}; END {printf("\x01|"$1":"$2)}')
> taskbar_info=$(echo -e $cpu_temp $root_vol $home_vol $vol $date $uptime)
>
> xsetroot -name "$taskbar_info"
> sleep 5
> done
> ************
>
> There should be "if $cpu_temp > 60 then; "do the command again with red
> colors", and how can I check the range of "if" condition? For example:
> when cpu temp is [50-55] then it should be blue, when it goes up to
> [60-65]
> then red, so "if $cpu_temp == [50-55]; then "do command", but it doesn't
> work(. Can somebody help me with syntax? Forgive me my ignorance, but I
> will
> be very thankful if somebody will help with it.
>
> Tian

I've sorted this with a script: http://wklej.org/id/529183/
and here's my ~/.xinitrc http://wklej.org/id/529182/

The colors are defined in config.h:

static const char colors[NUMCOLORS][ColLast][8] = {
         // border foreground background
         { "#333333", "#cccccc", "#222222" }, // 0 = normal
         { "#888888", "#ffffff", "#555555" }, // 1 = selected
         { "#333333", "#3399ff", "#222222" }, // 2 = light blue
         { "#333333", "#ff0000", "#222222" }, // 3 = red
         { "#333333", "#8afb17", "#222222" }, // 4 = green
         { "#333333", "#fdd017", "#222222" }, // 5 = yellow
         { "#333333", "#ffffff", "#222222" }, // 6 = white
         { "#333333", "#ff9900", "#222222" }, // 7 = orange
};
Received on Sat May 14 2011 - 17:15:24 CEST

This archive was generated by hypermail 2.2.0 : Sat May 14 2011 - 17:24:03 CEST