You are not logged in.
$ baraction.sh
cat: /proc/acpi/battery/BAT/state: File o directory non esistente
cat: /proc/acpi/battery/BAT/info: File o directory non esistente
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
error Tcpu=60.0°C, F= Freq:1666 1666 Load: 138 136 138 Mem:20% FASTWEB-1-8yqbu822d6Cj: Q=100% S/N=-39/-256dBm T=200dBm
cat: /proc/acpi/battery/BAT/state: File o directory non esistente
cat: /proc/acpi/battery/BAT/info: File o directory non esistente
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
error Tcpu=60.0°C, F= Freq:1666 1666 Load: 135 136 138 Mem:20% FASTWEB-1-8yqbu822d6Cj: Q=100% S/N=-38/-256dBm T=200dBm
cat: /proc/acpi/battery/BAT/state: File o directory non esistente
cat: /proc/acpi/battery/BAT/info: File o directory non esistente
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
error Tcpu=60.0°C, F= Freq:1666 1666 Load: 132 135 138 Mem:20% FASTWEB-1-8yqbu822d6Cj: Q=100% S/N=-38/-256dBm T=200dBm
cat: /proc/acpi/battery/BAT/state: File o directory non esistente
cat: /proc/acpi/battery/BAT/info: File o directory non esistente
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
error Tcpu=60.0°C, F= Freq:1666 1666 Load: 130 134 138 Mem:20% FASTWEB-1-8yqbu822d6Cj: Q=100% S/N=-38/-256dBm T=200dBm
cat: /proc/acpi/battery/BAT/state: File o directory non esistente
cat: /proc/acpi/battery/BAT/info: File o directory non esistente
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
error Tcpu=60.0°C, F= Freq:1666 1666 Load: 133 135 138 Mem:20% FASTWEB-1-8yqbu822d6Cj: Q=100% S/N=-38/-256dBm T=200dBm
cat: /proc/acpi/battery/BAT/state: File o directory non esistente
cat: /proc/acpi/battery/BAT/info: File o directory non esistente
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
error Tcpu=60.0°C, F= Freq:1666 1666 Load: 131 134 138 Mem:20% FASTWEB-1-8yqbu822d6Cj: Q=100% S/N=-37/-256dBm T=200dBm
cat: /proc/acpi/battery/BAT/state: File o directory non esistente
cat: /proc/acpi/battery/BAT/info: File o directory non esistente
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
error Tcpu=60.0°C, F= Freq:1666 1666 Load: 128 134 137
Last edited by 0-day (2016-08-14 12:34:43)
Offline
Is that output from the baraction.sh included with the spectrwm tarball/git download?
I think that script is actually written for a system running *BSD - pretty sure it's going to need some major reworking for a linux system.
You can post the contents of the script in case someone wants to attempt it.
You must unlearn what you have learned.
-- yoda
Offline
#!/bin/bash
# baraction.sh for spectrwm status bar
# From http://wiki.archlinux.org/index.php/Scrotwm
SLEEP_SEC=5
#loops forever outputting a line every SLEEP_SEC secs
while :; do
eval $(cat /proc/acpi/battery/BAT0/state | awk '/charging state/ {printf "BAT_CHGSTATE=%s;", $3}; /remaining capacity/ {printf "BAT_REMNG=%s;",$3}; /present rate/ {printf "BAT_RATE=%s;",$3};' -)
eval $(cat /proc/acpi/battery/BAT0/info | awk '/present/ {printf "BAT_PRESENT=%s;", $2}; /last full capacity/ {printf "BAT_LASTFULL=%s;",$4};' -)
BAT_REMNG_WH=`echo "scale=1; a=($BAT_REMNG+50)/1000; print a" | bc -l`
BAT_RATE_W=`echo "scale=1; a=($BAT_RATE+50)/1000; print a" | bc -l`
BCSCRIPT="scale=0; a=(100*$BAT_REMNG / $BAT_LASTFULL); print a"
BAT_PCT=`echo $BCSCRIPT | bc -l`%
case $BAT_PRESENT in
no)
POWER_STR="AC, NO BATTERY"
;;
yes)
case $BAT_CHGSTATE in
charged)
#on ac
AC_STATUS="ON AC"
TIME_REMNG="N/A"
POWER_STR="$AC_STATUS $BAT_CHGSTATE $BAT_PCT"
;;
charging)
#on ac
AC_STATUS="ON AC"
BCSCRIPT="scale=1; a=(60*($BAT_LASTFULL - $BAT_REMNG) / $BAT_RATE); print a"
TIMETOFULL_MIN=`echo $BCSCRIPT | bc -l`
POWER_STR="$AC_STATUS $BAT_CHGSTATE $BAT_PCT C="$BAT_REMNG_WH"Wh Rate="$BAT_RATE_W"W TTF="$TIMETOFULL_MIN"min"
;;
discharging)
AC_STATUS="ON BATT"
TIME_REMNG_MIN=`echo "scale=0; a=(60*$BAT_REMNG / $BAT_RATE); print a" | bc -l`
TIME_REMNG_HH=`echo "scale=0; a=($BAT_REMNG / $BAT_RATE); if (a<10) {print "0"; print a} else {print a}" | bc -l`
TIME_REMNG_MM=`echo "scale=0; a=($TIME_REMNG_MIN-60*$TIME_REMNG_HH); if (a<10) {print "0"; print a} else {print a}" | bc -l`
POWER_STR="$AC_STATUS $BAT_PCT C="$BAT_REMNG_WH"Wh P="$BAT_RATE_W"W R="$TIME_REMNG_HH":"$TIME_REMNG_MM
;;
*)
POWER_STR=$BAT_CHGSTATE
;;
esac
;;
*)
POWER_STR="error"
;;
esac
#spectrwm bar_print can't handle UTF-8 characters, such as degree symbol
#Core 0: +67.0?C (crit = +100.0?C)
eval $(sensors 2>/dev/null | sed s/[?+]//g | awk '/^Core 0/ {printf "CORE0TEMP=%s;", $3}; /^Core 1/ {printf "CORE1TEMP=%s;",$3}; /^fan1/ {printf "FANSPD=%s;",$2};' -)
TEMP_STR="Tcpu=$CORE0TEMP,$CORE1TEMP F=$FANSPD"
WLAN_ESSID=$(iwconfig wlan0 | awk -F "\"" '/wlan0/ { print $2 }')
eval $(cat /proc/net/wireless | sed s/[.]//g | awk '/wlan0/ {printf "WLAN_QULTY=%s; WLAN_SIGNL=%s; WLAN_NOISE=%s", $3,$4,$5};' -)
BCSCRIPT="scale=0;a=100*$WLAN_QULTY/70;print a"
WLAN_QPCT=`echo $BCSCRIPT | bc -l`
WLAN_POWER=`iwconfig 2>/dev/null| grep "Tx-Power"| awk {'print $4'}|sed s/Tx-Power=//`
WLAN_STR="$WLAN_ESSID: Q=$WLAN_QPCT% S/N="$WLAN_SIGNL"/"$WLAN_NOISE"dBm T="$WLAN_POWER"dBm"
CPUFREQ_STR=`echo "Freq:"$(cat /proc/cpuinfo | grep 'cpu MHz' | sed 's/.*: //g; s/\..*//g;')`
CPULOAD_STR="Load:$(uptime | sed 's/.*://; s/,//g')"
eval $(awk '/^MemTotal/ {printf "MTOT=%s;", $2}; /^MemFree/ {printf "MFREE=%s;",$2}' /proc/meminfo)
MUSED=$(( $MTOT - $MFREE ))
MUSEDPT=$(( ($MUSED * 100) / $MTOT ))
MEM_STR="Mem:${MUSEDPT}%"
echo -e "$POWER_STR $TEMP_STR $CPUFREQ_STR $CPULOAD_STR $MEM_STR $WLAN_STR"
#alternatively if you prefer a different date format
#DATE_STR=`date +"%H:%M %a %d %b`
#echo -e "$DATE_STR $POWER_STR $TEMP_STR $CPUFREQ_STR $CPULOAD_STR $MEM_STR $WLAN_STR"
sleep $SLEEP_SEC
done
everything works except the battery section
Last edited by 0-day (2016-08-12 09:49:50)
Offline
Check the contents of /proc/acpi/battery/
Your battery may not be called BAT0, on my HP it was always BAT1.
You must unlearn what you have learned.
-- yoda
Offline
/proc/acpi It contains a folder and file:button folder and wakeup file
Offline
Looks like the battery sections of the script may be depricated. You will have to edit your script to get the battery state.
You must unlearn what you have learned.
-- yoda
Offline
#!/bin/bash
# baraction.sh for spectrwm status bar
# From http://wiki.archlinux.org/index.php/Scrotwm
SLEEP_SEC=5
#loops forever outputting a line every SLEEP_SEC secs
while :; do
# power output
BAT=`acpi -b`
CHARGE=`acpi -b | awk '{printf("%d", $4)}'`
AC=`acpi -a | awk '{printf("%s", $3)}'`
# if AC connected
if [ "$AC" = 'on-line' ]
then
#if battery connected and charging
# TO DO check
if [ -n "$BAT" ]
then
# TO DO make % green to show charged/ing
POWER="${CHARGE}%"
else
#is only on AC
POWER="AC"
fi
else # hence is not on AC so is discharging battery
POWER="${CHARGE}%"
# if [ "$CHARGE -gt "20" ]
# then
# #TO DO make orange for > 20%
# POWER="${CHARGE}%"
# else
# #TO DO make red for < 20%# POWER="${CHARGE}%"
# fi
fi
#spectrwm bar_print can't handle UTF-8 characters, such as degree symbol
#Core 0: +67.0?C (crit = +100.0?C)
eval $(sensors 2>/dev/null | sed s/[?+]//g | awk '/^Core 0/ {printf "CORE0TEMP=%s;", $3}; /^Core 1/ {printf "CORE1TEMP=%s;",$3}; /^fan1/ {printf "FANSPD=%s;",$2};' -)
TEMP_STR="Tcpu=$CORE0TEMP,$CORE1TEMP F=$FANSPD"
WLAN_ESSID=$(iwconfig wlan0 | awk -F "\"" '/wlan0/ { print $2 }')
eval $(cat /proc/net/wireless | sed s/[.]//g | awk '/wlan0/ {printf "WLAN_QULTY=%s; WLAN_SIGNL=%s; WLAN_NOISE=%s", $3,$4,$5};' -)
BCSCRIPT="scale=0;a=100*$WLAN_QULTY/70;print a"
WLAN_QPCT=`echo $BCSCRIPT | bc -l`
WLAN_POWER=`iwconfig 2>/dev/null| grep "Tx-Power"| awk {'print $4'}|sed s/Tx-Power=//`
WLAN_STR="$WLAN_ESSID: Q=$WLAN_QPCT% S/N="$WLAN_SIGNL"/"$WLAN_NOISE"dBm T="$WLAN_POWER"dBm"
CPUFREQ_STR=`echo "Freq:"$(cat /proc/cpuinfo | grep 'cpu MHz' | sed 's/.*: //g; s/\..*//g;')`
CPULOAD_STR="Load:$(uptime | sed 's/.*://; s/,//g')"
eval $(awk '/^MemTotal/ {printf "MTOT=%s;", $2}; /^MemFree/ {printf "MFREE=%s;",$2}' /proc/meminfo)
MUSED=$(( $MTOT - $MFREE ))
MUSEDPT=$(( ($MUSED * 100) / $MTOT ))
MEM_STR="Mem:${MUSEDPT}%"
echo -e "$POWER_STR $TEMP_STR $CPUFREQ_STR $CPULOAD_STR $MEM_STR $WLAN_STR"
#alternatively if you prefer a different date format
#DATE_STR=`date +"%H:%M %a %d %b`
#echo -e "$DATE_STR $POWER_STR $TEMP_STR $CPUFREQ_STR $CPULOAD_STR $MEM_STR $WLAN_STR"
sleep $SLEEP_SEC
done
This works even if you launch it from the terminal gives me no errors but the% bat there is not
Offline
a simple working baraction.sh with clock cpu% ram% bat%?
thanks
Last edited by 0-day (2016-08-13 18:57:40)
Offline
You have acpi installed? In a teminal:
acpi -b
outputs the battery information?
Easiest way to get what you want is with conky; just need to set up conkyrc so it is out to console:
.conkyrc for conky 1.10 -
conky.config = {
out_to_console = true,
out_to_x = false,
background = false,
uppercase = true,
update_interval = 1,
total_run_times = 0,
use_spacer = 'none',
};
conky.text = [[
CPU: ${cpu cpu0}% Mem: ${memperc}% Batt: ${battery_percent BAT0}%
]];
then in your .spectrwm.conf
bar_action = conky
You can find some more examples in the "show your conky" thread.
spectrwm with conky piped to bar:
Last edited by PackRat (2016-08-13 19:44:56)
You must unlearn what you have learned.
-- yoda
Offline
out_to_x no
out_to_console yes
update_interval 1.0
total_run_times 0
use_spacer none
TEXT
Up:${uptime_short} |Temp:${acpitemp}C | ${addr wlan0} |RAM:$memperc% |CPU:${cpu}% | ${downspeedf wlan0} | Batt:${battery_short}
this works thanks
Last edited by 0-day (2016-08-13 22:08:51)
Offline
Good. Please mark the thread as solved.
You must unlearn what you have learned.
-- yoda
Offline
% Bat works on netbook, but not on the hp nx6110 notebook:
$ acpi -b
Battery 0: Discharging, 15%, 00:18:22 remaining
Last edited by 0-day (2016-08-14 10:16:09)
Offline
Batt:${execi 60 acpi | grep -Eo '\w+,' | grep -Eo '\w+'}
this code dispaly in conky:charging
Offline
Using that same conky code?
Check over in the conky thread, this issue comes up every now and then so you may find a solution in that thread.
You must unlearn what you have learned.
-- yoda
Offline
solved!!! with:
Up:${uptime_short} |Temp:${acpitemp}C | ${addr wlan0} |RAM:$memperc% |CPU:${cpu}% | ${downspeedf wlan0} | Batt:${execi 60 acpi -b | awk '{print$5}'} ${alignr} (${execi 60 acpi -b | awk '{print $4}' | cut -b -3})
thanks!
Offline