On 07/02/2011 11:55, Thomas Dahms wrote:

With the sh wmiirc, you can also change color of the status bar, with
something like
wmiir xwrite /rbar/status "color #555555 #ededeb #dcdcdb"

You can only write label (i.e. text) or color at a time, so you have to
modify the "Action status" piece in wmiirc to write both after another.
Note that /rbar/status includes the whole right status bar by default.
Defining another /rbar/battery is probably what you want in order to
change color of only this.


Thanks a lot for your explanation! Now I'm a bit excited I can do it with wmiirc but it still slips through my fingers, I don't understand enough of wmii. If you could help me out with one example then I'll get it working..

So I'm starting off with the following defaults in my wmiirc sh script:

status() {
  echo -n $(date '+%a %d %b, %H:%M:%S %Z')
}

Action status
  set +xv
  if wmiir remove /rbar/status 2>/dev/null; then
  sleep 2
  fi
  echo "$WMII_NORMCOLORS" | wmiir create /rbar/status
  while status | wmiir write /rbar/status; do
  sleep 1
done

I'm creating /rbar/cpu by adding:
  echo "$WMII_NORMCOLORS" | wmiir create /rbar/cpu
in "Action status" (just after creating /rbar/status).

Now I want it to hold the output of "sysctl -n dev.cpu.0.freq" command and I want it to get refreshed every second (it returns for example "700" or "2500" without quotes).

If I wanted to put it in the /rbar/status I would add:
  echo -n 'CPU:' $(sysctl -n dev.cpu.0.freq) 'MHz'
to the "status()" part.

But how can I put it in the /rbar/cpu? I know I can do it manually by issuing:
  wmiir xwrite /rbar/status `sysctl -n dev.cpu.0.freq`
on the terminal, but then obviously it's not being refreshed/rewritten every second.

For now I'm not bothered with colors etc. I just need a working example of how to automatically put some data (refreshed every second) into my /rbar/cpu. Any ideas please?

Michael

Reply via email to