Bitcoin charts in status bar and some fixes
This commit is contained in:
parent
89ca2d6825
commit
3ec42e950b
4 changed files with 61 additions and 13 deletions
32
Utils/BTC_stats.sh
Executable file
32
Utils/BTC_stats.sh
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
file=/dev/shm/btc_stats
|
||||
fileURL=http://api.bitcoincharts.com/v1/weighted_prices.json
|
||||
|
||||
function update_file {
|
||||
wget --quiet $fileURL -O $file
|
||||
#echo WILL_WGET
|
||||
}
|
||||
|
||||
if [ -e $file ]; then
|
||||
#update if older than 1h
|
||||
age=`stat -c %Y $file`;
|
||||
now=`date +%s`;
|
||||
diff=$(($now - $age));
|
||||
if [ $diff -gt 3600 ]; then
|
||||
update_file & #Do not hang the result
|
||||
fi;
|
||||
|
||||
#Fucking ugly, but works
|
||||
content=`cat $file | python -mjson.tool | grep -A3 EUR | tail -n3 | cut -d':' -f2 | cut -d'"' -f2`;
|
||||
|
||||
p24h=`echo "$content" | sed -n 1p`
|
||||
p7d=`echo "$content" | sed -n 3p`
|
||||
p30d=`echo "$content" | sed -n 2p`
|
||||
|
||||
graph=`sparklines $p30d $p7d $p24h`
|
||||
echo $graph [$p24h€] #dont want sparklines newline
|
||||
else
|
||||
update_file & #Will surely wait for iface
|
||||
fi
|
||||
|
|
@ -34,18 +34,20 @@ case $1 in
|
|||
;;
|
||||
|
||||
"audio")
|
||||
#so that '$0 refresh' will be up2date (song didn't change after)
|
||||
mpc_cmd='mpc --wait'
|
||||
case $2 in
|
||||
"toggle")
|
||||
mpc toggle
|
||||
$mpc_cmd toggle
|
||||
;;
|
||||
"pause")
|
||||
mpc pause
|
||||
$mpc_cmd pause
|
||||
;;
|
||||
"next")
|
||||
mpc next
|
||||
$mpc_cmd next
|
||||
;;
|
||||
"prev")
|
||||
mpc prev
|
||||
$mpc_cmd prev
|
||||
;;
|
||||
esac
|
||||
$0 refresh
|
||||
|
@ -100,26 +102,32 @@ case $1 in
|
|||
;;
|
||||
|
||||
"refresh")
|
||||
DATE=`date +"%A %d, %Hh%M - %s"`
|
||||
DATE=`date +"%a %e %Hh%M"`
|
||||
|
||||
BATT_PCT=$(acpi -b | cut -d, -f2 | cut -d" " -f2)
|
||||
BATT_TIME=$(acpi -b | cut -d, -f3 | cut -d" " -f2)
|
||||
#BATT=$( acpi -b | sed 's/.*[charg.|], \([0-9]*\)%.*/\1/gi' )
|
||||
|
||||
VOLUME=`/usr/bin/amixer get Master | grep "%" | cut -d' ' -f7 | head -n1`
|
||||
## VOLUME=`amixer get Master | grep '\[' | cut -d' ' -f6`
|
||||
|
||||
SONG=`mpc | head -n 1 | cut -d. -f1`
|
||||
maxSL=22
|
||||
if [ ${#SONG} -gt $maxSL ]; then
|
||||
SONG=`echo $SONG | cut -c1-$maxSL`.
|
||||
fi
|
||||
BTC=`BTC_stats.sh`
|
||||
|
||||
if [ -n `mpc | grep paused` ]; then
|
||||
STAT=">"
|
||||
STAT="♫"
|
||||
else
|
||||
STAT="||"
|
||||
STAT=""
|
||||
fi;
|
||||
|
||||
MEMFREE=`awk '/MemFree/ {printf( "%.0f", $2 / 1024 )}' /proc/meminfo`
|
||||
MEMCACHED=`awk '/Cached/ {printf( "%.0f", $2 / 10240 )}' /proc/meminfo`
|
||||
MEMFT=`echo "$MEMFREE + $MEMCACHED" | bc`
|
||||
BEAT_TIME=`beat -v`
|
||||
|
||||
xsetroot -name "Vol $VOLUME :: [$STAT $SONG] :: $MEMFT Mb Free :: Bat $BATT_PCT $BATT_TIME :: $DATE (@$BEAT_TIME)" || true
|
||||
xsetroot -name "$VOLUME [$STAT $SONG] :: $MEMFT Mb Free :: Bat $BATT_PCT $BATT_TIME :: $BTC :: $DATE" || true
|
||||
$0 conf-ifaces
|
||||
;;
|
||||
|
||||
|
|
|
@ -4,7 +4,12 @@
|
|||
/* appearance */
|
||||
//static const char font[] = "-*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*";
|
||||
//static const char font[] = "-*-dejavu sans-medium-r-*-*-14-*-*-*-*-*-*-*";
|
||||
static const char font[] = "-misc-fixed-medium-r-semicondensed--13-100-100-100-c-60-iso8859-1";
|
||||
//static const char font[] = "-misc-fixed-medium-r-semicondensed--13-100-100-100-c-60-iso8859-1";
|
||||
//static const char font[] = "-*-terminusmod-medium-r-normal-*-12-*-*-*-*-*-*-*";
|
||||
//
|
||||
//
|
||||
static const char font[] = "-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*";
|
||||
//static const char font[] = "-*-terminus-medium-*-*-*-14-*-*-*-*-*-iso10646-1";
|
||||
static const char normbordercolor[] = "#444444";
|
||||
static const char normbgcolor[] = "#222222";
|
||||
static const char normfgcolor[] = "#bbbbbb";
|
||||
|
|
7
xinitrc
7
xinitrc
|
@ -33,16 +33,19 @@ if [ $? -eq 1 ]; then
|
|||
mpd &
|
||||
fi;
|
||||
|
||||
#The status bar
|
||||
while true; do
|
||||
$OCTOPUS refresh
|
||||
sleep 50
|
||||
done &
|
||||
|
||||
#The wallpaper
|
||||
while true; do
|
||||
sleep 240
|
||||
$OCTOPUS wallpaper
|
||||
done &
|
||||
|
||||
#The mouse
|
||||
while true; do
|
||||
sleep 120
|
||||
$OCTOPUS init-mouse
|
||||
|
@ -52,9 +55,9 @@ done &
|
|||
#xautolock -time 60 -locker "systemctl suspend" &
|
||||
redshift -l 46:6 || true &
|
||||
|
||||
#WTF is wrong with it always forgetting the playlist !?
|
||||
#WTF is wrong with it always forgetting the fucking playlist !?
|
||||
mpc ls | mpc add
|
||||
mpc random
|
||||
mpc random on
|
||||
|
||||
#ssh-agent -t 10 /home/frank/Programmation/dotfiles/dwm/dwm
|
||||
/home/frank/Programmation/dotfiles/dwm/dwm
|
||||
|
|
Loading…
Reference in a new issue