On Sat, Apr 23, 2011 at 21:54:16 +0100, Nicholas Marriott wrote: > hmmm i can't reproduce. can you do the same script dance with "tmux > -vvvv -Ltest -f/dev/null" and see if it is redrawing the screen all the > same there too? No it doesn not. I've attached the new typescript output too.
> what is in battery_tmux_status.sh?
#!/bin/sh -e
set -e
BATTERY_INFO=$(sysctl -n hw.sensors.acpibat0.raw0)
typeset -i BATTERY
BATTERY=$(echo "${BATTERY_INFO}" |cut -d' ' -f1)
FULL_CAPACITY=$(sysctl -n hw.sensors.acpibat0.watthour0 |cut -d' ' -f1)
WARNING_CAPACITY=$(sysctl -n hw.sensors.acpibat0.watthour1 |cut -d' ' -f1)
LOW_CAPACITY=$(sysctl -n hw.sensors.acpibat0.watthour2 |cut -d' ' -f1)
REMAINING_CAPACITY=$(sysctl -n hw.sensors.acpibat0.watthour3 |cut -d' ' -f1)
REMAINING_PERCENTAGE=$( echo "scale=1; ${REMAINING_CAPACITY} * 100 /
${FULL_CAPACITY}" |bc )
case ${BATTERY} in
0) # battery full
printf "AC${BATTERY_INFO##*,}\n"
;;
1) # battery discharging
if [ ${REMAINING_CAPACITY%%.*} -gt ${WARNING_CAPACITY%%.*}
];then
printf '#[bg=white]'
fi
if [ ${REMAINING_CAPACITY%%.*} -le ${WARNING_CAPACITY%%.*} ]
;then
printf '#[bg=red]LOW BATTERY '
fi
printf "${REMAINING_PERCENTAGE}%%${BATTERY_INFO##*,}\n"
;;
2) # battery charging
printf "AC${BATTERY_INFO##*,}^${REMAINING_PERCENTAGE}%%\n"
;;
esac
Daniel
--
LÉVAI Dániel
PGP key ID = 0x83B63A8F
Key fingerprint = DBEC C66B A47A DFA2 792D 650C C69B BE4C 83B6 3A8F
typescript
Description: Binary data
------------------------------------------------------------------------------ WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________ tmux-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tmux-users
