#!/bin/bash
-function music {
- song=$([ "$(mpc | wc -l)" = "1" ] && echo "[stopped]" || echo $(mpc | head -1))
- status=$(mpc | grep -o "\[p.*\]")
- echo -ne "♪: $song$status | "
+item(){
+ echo "{\"full_text\": \"$1\"}$2"
}
-function net {
- cat /run/network/ifstate | grep -q $1 && echo "$2 | "
+battery(){
+ path=/sys/class/power_supply
+ now=$(($(cat "$path/BAT0/charge_now")*100/$(cat "$path/BAT0/charge_full")))%
+ [ "$(cat "$path/ADP1/online")" -eq "1" ] && charge="(C)"
+ [ "$now" = "100%" ] && now="FULL"
+ echo -n "$now$charge"
}
-function volume {
- volume=$(amixer | grep -A4 Master | grep -o "[0-9]\{1,3\}%\|\[off\]")
- echo -ne "♬: $volume | "
-}
-
-function temp {
- temp=$(sensors|grep temp1|head -1|awk '{print $2}')
- echo -ne "⚠: $temp | "
-}
-
-function battery {
- pa="/sys/class/power_supply/BAT0"
- power=$(echo "$(cat $pa/charge_now)*100/$(cat $pa/charge_full)" | bc)
- charge=""
- if [ "$(cat $pa/status)" = "Charging" ]; then
- charge="(C)"
- fi
- echo -ne "⚡: $power%$charge | "
-}
-
-while [ 1 ]; do
- echo "$(music)$(volume)$(net wlan0 W)$(net eth0 E)$(net usb0 U)$(temp)$(battery)$(date +%y-%m-%d\ %H:%M)"
- sleep 5
+while true;
+do
+ echo "$(battery) | $(date +%x\ %X)"
+ sleep 1
done