-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatus.sh
executable file
·26 lines (20 loc) · 948 Bytes
/
status.sh
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
#!/bin/sh
# If there is a battery, then print it's info
test -d /sys/class/power_supply/BAT0/ && (
# If there is less than 30% charge, add a red battery icon
test $(cat /sys/class/power_supply/BAT0/capacity) -lt 30 && echo -n 🪫
# Add an indicator for if the charge is increasing, decreasing, or staying the same
bat_status=$(< /sys/class/power_supply/BAT0/status)
test "$bat_status" "==" Full && echo -n ■
test "$bat_status" "==" Charging && echo -n ▲
test "$bat_status" "==" Discharging && echo -n ▼
test "$bat_status" "==" "Not charging" && echo -n ○
# Add the percentage charge
echo -n "$(cat /sys/class/power_supply/BAT0/capacity)% ○ "
)
# Add the internal temprature
cat /sys/class/thermal/thermal_zone0/temp | awk '{printf ($1/1000) "°C ○ "}'
# Add the memory usage in GB and percent
free | grep Mem: | awk '{printf int($3/10000)/100 "GB " int($3/$2*100) "% ○ "}'
# Add the date
date +'%d/%m/%y ○ %I:%M'