[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Variable colors in hardstatus line

From: Adrian Rollett
Subject: Re: Variable colors in hardstatus line
Date: Wed, 28 Jan 2009 12:50:44 -0600

I've found that the only way to implement something like this is to 
have your backtick script vary the output according to the temperature. 
For instance, here's a fragment from a script I use to output the 
current disk use, colored according to percentage used:

    if [[ "${PERCENTAGE}" -lt 85 ]]
      echo -n "{= Kg}${HOST} ${DISK} (${PERCENTAGE}%)"
    elif [[ "${PERCENTAGE}" -lt 92 ]]
      echo -n "{= Ky}${HOST} ${DISK} (${PERCENTAGE}%)"
      echo -n "{= Kr}${HOST} ${DISK} (${PERCENTAGE}%)"
    echo "{= Kk}"


Adrian Rollett                          | Systems Manager
address@hidden          | [Central Web address@hidden

On Tue, 27 Jan 2009 20:47:46 -0600, Chris Jones wrote:
> My hardstatus line invokes fairly elaborate backticks that tell me all I
> need to know about the current state of my system.
> I was thinking of making it more readable by enhancing it with a bit of
> color.
> One backtick for instance tells me how hot my system is running and
> since /proc/acpi/thermal_zone/THRM/trip_points contains:
>   critical (S5):           115 C
>   active[0]:               86 C: devices=FAN1
>   active[1]:               76 C: devices=FAN0
> ..I thought I might color the display, green, orange, and red, depending
> on where in the above range my system's temperature currently falls.
> I just tested a backtick that specifies the required xterm ctlseq's:
>   echo -e "\033[38;5;160m $systemp \033[0m"
> i.e. I am writing the contents of the $temp variable to stdout using
> foreground color 160 in my xterm's 256-color palette.
> This works fine when I run it from a bash prompt .. prints my system's
> current temperature in dark pink letters, but when run as a screen
> backtick it displays "\033[38;5;160m 56C \033[0m" - white letters on a
> black background.
> Is there any way I can use the current gnu/screen framework to
> dynamically choose the color of the hardstatus line contents in order to
> highlight critical pieces of data, or do I need to hack the code to
> achieve this?
> Thanks,
> CJ
> _______________________________________________
> screen-users mailing list
> address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]