added colors
This commit is contained in:
+23
-13
@@ -11,8 +11,13 @@
|
|||||||
# colors from dwm.config.h
|
# colors from dwm.config.h
|
||||||
color_normal="\x01" #normal
|
color_normal="\x01" #normal
|
||||||
color_selected="\x02" #selected
|
color_selected="\x02" #selected
|
||||||
|
color_urgent="\x03" #urgent
|
||||||
|
color_important="\x04" #important
|
||||||
|
color_yellow="\x05" #yellow
|
||||||
color_blue="\x06" #blue
|
color_blue="\x06" #blue
|
||||||
color_red="\x03" #red
|
color_cyan="\x07" #cyan
|
||||||
|
color_magenta="\x08" #magenta
|
||||||
|
color_grey="\x09" #grey
|
||||||
|
|
||||||
# Icon glyphs from Inconsolataicon
|
# Icon glyphs from Inconsolataicon
|
||||||
glyph_cpu="\u01B0"
|
glyph_cpu="\u01B0"
|
||||||
@@ -37,19 +42,24 @@ msc(){
|
|||||||
song_info=${artist}-${song}
|
song_info=${artist}-${song}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -ne "${glyph_msc} ${song_info}"
|
echo -ne "${color_selected}${glyph_msc} ${song_info}${color_normal}"
|
||||||
}
|
}
|
||||||
|
|
||||||
#Date
|
#Date
|
||||||
dte(){
|
dte(){
|
||||||
datetime="$(date "+%F %T")"
|
datetime="$(date "+%F %T")"
|
||||||
echo -ne "${glyph_clk} ${datetime}"
|
echo -ne "${color_selected}${glyph_clk} ${datetime}${color_normal}"
|
||||||
}
|
}
|
||||||
|
|
||||||
#Power and Battery
|
#Power and Battery
|
||||||
bat(){
|
bat(){
|
||||||
charge=`acpi -b | awk '{print +$4}'`
|
charge=`acpi -b | awk '{print +$4}'`
|
||||||
echo -ne "${glyph_pow} ${charge}%"
|
if [ $charge -lt "25" ]
|
||||||
|
then
|
||||||
|
echo -ne "${color_urgent}${glyph_pow} ${charge}%${color_normal}"
|
||||||
|
else
|
||||||
|
echo -ne "${color_selected}${glyph_pow} ${charge}%${color_normal}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#Volume
|
#Volume
|
||||||
@@ -72,20 +82,20 @@ mem(){
|
|||||||
|
|
||||||
#CPU
|
#CPU
|
||||||
load(){
|
load(){
|
||||||
cpu="$(uptime | awk '{print +$8, +$9, +$10}')"
|
cpu="$(cat /proc/loadavg | awk '{print $1, $2, $3}')"
|
||||||
echo -ne "${glyph_cpu} ${cpu}"
|
echo -ne "${glyph_cpu} ${cpu}"
|
||||||
}
|
}
|
||||||
|
|
||||||
#Network
|
#Network
|
||||||
rx_old=$(cat /sys/class/net/wlp1s0/statistics/rx_bytes)
|
rx_old=$(cat /sys/class/net/wlp1s0/statistics/rx_bytes)
|
||||||
tx_old=$(cat /sys/class/net/wlp1s0/statistics/rx_bytes)
|
tx_old=$(cat /sys/class/net/wlp1s0/statistics/tx_bytes)
|
||||||
while true; do
|
while true; do
|
||||||
#get new rx/tx counts
|
#get new rx/tx counts
|
||||||
rx_now=$(cat /sys/class/net/wlp1s0/statistics/rx_bytes)
|
rx_now=$(cat /sys/class/net/wlp1s0/statistics/rx_bytes)
|
||||||
tx_now=$(cat /sys/class/net/wlp1s0/statistics/rx_bytes)
|
tx_now=$(cat /sys/class/net/wlp1s0/statistics/tx_bytes)
|
||||||
#calculate rate (K)
|
#calculate rate (K) divide by 1024 * polling rate (sleep below)
|
||||||
let rx_rate=($rx_now-$rx_old)/1024
|
let rx_rate=($rx_now-$rx_old)/2048
|
||||||
let tx_rate=($tx_now-$tx_old)/1024
|
let tx_rate=($tx_now-$tx_old)/2048
|
||||||
rx_rate(){
|
rx_rate(){
|
||||||
echo -ne "${glyph_dl} ${rx_rate}K"
|
echo -ne "${glyph_dl} ${rx_rate}K"
|
||||||
}
|
}
|
||||||
@@ -93,11 +103,11 @@ while true; do
|
|||||||
echo -ne "${glyph_ul} ${tx_rate}K"
|
echo -ne "${glyph_ul} ${tx_rate}K"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Pipe to statusbar
|
# Pipe to statusbar
|
||||||
xsetroot -name "$(msc) $(load) $(mem) $(rx_rate)$(tx_rate) $(bat) $(vol) $(dte) "
|
xsetroot -name "$(msc) $(load) $(mem) $(rx_rate)$(tx_rate) $(bat) $(vol) $(dte) "
|
||||||
|
|
||||||
#reset rates
|
#reset rates
|
||||||
rx_old=$rx_now
|
rx_old=$rx_now
|
||||||
tx_old=$tx_now
|
tx_old=$tx_now
|
||||||
sleep 1
|
sleep 2
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user