Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to get the X screensaver gltext to monitor my system temp and maybe some other stats. Writing a script that puts together the stats periodically is no problem, but the main thing I'm running into is that gltext doesn't refresh - whatever text I feed it stays there.

So, for example, I run this command:

$ /usr/lib/xscreensaver/gltext -text "`cat /proc/acpi/thermal_zone/THRM/temperature`"

and get a gltext window showing:

temperature:             60 C

I can manipulate it and format it as necessary, but as my CPU heats up and cools down, it doesn't update, even if I include time variables that do.

I have a script that feeds gltext the time as the first line and the temp as the second line - and although the time updates continuously as the time changes, the temperature value remains the same as whenever the screensaver started.

Is it possible to do what I want, which is change the text every 60 seconds if the temperature changes?

share|improve this question
Can you post the part of your script you refer to ("I have a script that feeds gltext the time as the first line and the temp as the second line")? – Peter Jaric May 26 '10 at 8:43
Never mind, I found out how it works, see my answer. – Peter Jaric May 26 '10 at 8:55

Reading the documentation on gltext, it says:

Displays a few lines of text spinning around in a solid 3D font. The text can use strftime() escape codes to display the current date and time

This leads me to believe that the text sent into gltext is given to the function strftime and because of this, the time variables (escape codes) will be dynamically updated. There is no evidence of some similar functionality for arbitrary information, or program execution, and therefore I'll have to say that it is not possible to do what you want to do.

In your specific case, when you run gltext -text "`cat /proc/acpi/thermal_zone/THRM/temperature`", your command is run once, and the resulting output is converted to an argument that is sent at startup to gltext, which will not know anything about what command once produced it.

share|improve this answer
up vote 1 down vote accepted

I figured it out. gltext has a -program flag that allows you to feed any script into it, and it updates every 5 seconds. strftime escape codes aren't processed normally, so any script run by the -program flag needs to have a way to output time.

share|improve this answer
Cool! I didn't know that. You learn something every day. – Peter Jaric Jun 1 '10 at 18:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .