alpha
Login
or
Join now
j3s.sh
/
dotfiles
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
my dotz
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
Make bat red if it's low
author
Jes Olson
date
4 years ago
(Jun 13, 2022, 11:01 PM -0500)
commit
a346b7f4
a346b7f4010d95184bf78377df94516af84198f8
parent
7d457ec3
7d457ec35c9ec159b73cbd8c9f25b93719f07cd1
+10
-1
1 changed file
Expand all
Collapse all
Unified
Split
bin
nostromo
statusbar
+10
-1
bin/nostromo/statusbar
Reviewed
···
1
1
#!/bin/sh
2
2
3
3
+
get_bat() {
4
4
+
bat="$(cat /sys/class/power_supply/BAT1/capacity)"
5
5
+
if [ "$bat" -lt 10 ]; then
6
6
+
printf '\033[1m\033[31m%s%%\033[0m' "$bat"
7
7
+
else
8
8
+
printf '%s%%' "$bat"
9
9
+
fi
10
10
+
}
11
11
+
3
12
while true
4
13
do
5
14
time=$(date +"%A %Y-%m-%d %I:%M %p")
6
15
time="$time $(date -u +"(%H:%M UTC)")"
7
7
-
bat="$(cat /sys/class/power_supply/BAT1/capacity)%"
16
16
+
bat="$(get_bat)"
8
17
wifi="$(nmcli -t dev show wlp170s0 | grep GENERAL.CONNECTION | cut -d ':' -f 2)"
9
18
printf "wifi: %s | bat: %s | %s\n" "$wifi" "$bat" "$time"
10
19
sleep 10