1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | # ~/bin/dwm-statusbar
# Adapted from w0ng status bar: https://github.com/w0ng/bin
# Adapted from jasonwryan status bar: https://bitbucket.org/jasonwryan/shiv/src/1ad5950c3108a4e5a9dcb78888a1ccfeb9252b45/Scripts/dwm-status?at=default
# Some original work/modifications by frank: https://github.com/frank604
# Colour codes from dwm/config.h
clockColor="\x0B"
soundColor="\x0C"
freeSpaceColor="\x0D"
wifiColor="\x05"
batteryColor="\x06"
sensorColor="\x07"
rpmColor="\x08"
procColor="\x09"
memColor="\x0E"
#---separator
sp="$(echo -ne " ")"
sp1="$(echo -ne " | ")"
sp2="$(echo -ne "| ")"
sp3="$(echo -ne "|")"
#print_song_info() {
# track="$(mpc current)"
# artist="${track%%- *}"
# title="${track##*- }"
# [[ -n "$artist" ]] && echo -e "${color0}ê${sp}${color5}${artist}${color9}${title} ${color0}|"
#}
#
#
print_cpufreq() {
curr_freq="$(cpupower frequency-info | grep 'frequency is' | cut -c28-34)"
echo -ne "${color6}º${color0}${curr_freq}"
}
print_mem() {
make_free_work="$(unalias free)"
mem_used="$(free -m | grep 'Mem' | cut -c28-31)"
mem_free="$(free -m | grep 'Mem' | cut -c76-79)"
echo -ne "${memColor}${sp}Î${sp}${mem_used}M/${mem_free}M"
}
print_fan_speed() {
fan_speed="$( sensors | grep 'fan1:' | cut -c14-17 | head -1)"
echo -ne "${rpmColor}${sp}Ç${sp}${fan_speed}RPM"
}
print_cpu_temp() {
cpu_temp="$( sensors | grep 'temp1:' | cut -c16-17 | head -1)"
echo -ne "${sensorColor}${sp}ª${sp}${cpu_temp}°C"
}
print_power() {
status="$(cat /sys/class/power_supply/AC/online)"
battery="$(cat /sys/class/power_supply/BAT0/capacity)"
timer="$(acpi -b | grep "Battery" | awk '{print $5}' | cut -c 1-5)"
if [ "${status}" == 1 ]; then
echo -ne "${batteryColor}${sp}Â${sp}ON ${battery}"
else
echo -ne "${batteryColor}${sp}ð${sp}${battery}%:${timer}"
fi
}
print_wifiqual() {
wifiessid="$(/sbin/iwconfig 2>/dev/null | grep ESSID | cut -d: -f2)"
wifiawk="$(echo $wifiessid | awk -F',' '{gsub(/"/, "", $1); print $1}')"
wificut="$(echo $wifiawk | cut -d' ' -f1)"
echo -ne "${wifiColor}${sp}¤${sp}${wificut}"
}
print_hddfree() {
hddfree="$(df -Ph /dev/sda1 | awk '$3 ~ /[0-9]+/ {print $4}')"
echo -ne "${freeSpaceColor}${sp}¨${sp}${hddfree}"
}
print_homefree() {
hddfree="$(df -Ph /dev/sdb1 | awk '$3 ~ /[0-9]+/ {print $4}')"
echo -ne "${freeSpaceColor}${sp}¨${sp}${hddfree}"
}
print_volume(){
mix=`amixer get Master | tail -1`
vol="$(amixer get Master | tail -n1 | sed -r 's/.*\[(.*)%\].*/\1/')"
if [[ $mix == *\[off\]* ]]; then
#red 2
echo -e "${soundColor}${sp}í${sp} OFF"
elif [[ $mix == *\[on\]* ]]; then
#green 9
echo -e "${soundColor}${sp}í${sp}${vol}% "
else
#yellow6
echo -e "${soundColor}${sp}í${sp} ---"
fi
}
print_datetime() {
datetime="$(date "+%a %d %b %I:%M")"
echo -ne "${clockColor}${sp}É${sp}${datetime}"
}
while true; do
print_cpu() {
cpu="$( top -b -d1 -n2 | grep Cpu0 | cut -c22-24 | tail -n1 )"
echo -ne "${procColor}${sp}Ñ${sp}${cpu}%"
}
# Pipe to status bar, not indented due to printing extra spaces/tabs
xsetroot -name "$(print_mem)$(print_cpu)$(print_fan_speed)$(print_cpu_temp)$(print_power)$(print_wifiqual)$(print_homefree)$(print_hddfree)$(print_volume)$(print_datetime)"
# loop stats every 1 second
sleep 1
done
|
x
Notes
If you want to clone this, check this: https://bitbucket.org/skulltus/ultimate-dwm