blob: 9e39c9b5d6467cdb56b38ba5d410859841d011fb (
plain)
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
|
#!/bin/zsh
COLOR1="#0d0c13"
COLOR2="#70638F"
A0="%{B"$COLOR1"}%{F"$COLOR2"}%{B"$COLOR2"}%{F"$COLOR1"}"
A1="%{B"$COLOR2"}%{F"$COLOR1"}%{B"$COLOR1"}%{F"$COLOR2"}"
A2="%{B"$COLOR1"}%{F"$COLOR2"}%{B"$COLOR2"}%{F"$COLOR1"}"
clock() {
datetime=$(date +"%d %b(%A) %H:%M")
echo $datetime
}
cpu_load() {
read cpu a b c previdle rest < /proc/stat
prevtotal=$((a+b+c+previdle))
sleep 0.5
read cpu a b c idle rest < /proc/stat
total=$((a+b+c+idle))
cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))
echo -e "CPU: $cpu%"
}
cpu_temp() {
CEL=$'\xc2\xb0C'
temp=$( cat /sys/devices/virtual/thermal/thermal_zone0/temp )
temp=`expr $temp / 1000`
echo "TEMP: " $temp$CEL
}
root_usage() {
root=$(df -h / | awk 'NR==2 {print $4 "/" $2}')
echo "ROOT: "$root
}
home_usage() {
home=$(df -h /home | awk 'NR==2 {print $4 "/" $2}')
echo "HOME: "$home
}
mem_usage() {
mem=$(free -m | grep Mem: | awk '{print$3 / $2 * 100}')
printf "MEM: %.0f %%" $mem
}
volume() {
vol=$(pamixer --get-mute)
if [ $vol = "true" ]
then
echo "%{B#F15BB5}%{F#232627} ミュート"
fi
}
weather() {
echo "script broken"
# echo $(</tmp/weather_stat)
}
while :; do
echo "%{r}"$A0$A1$(weather)$A2$(cpu_temp)$A1$(cpu_load)$A2$(mem_usage)$A1$(root_usage)$A2$(home_usage)$A1$(volume)$A2$(clock)$A1
sleep 3
done
|