aboutsummaryrefslogtreecommitdiff
path: root/status
blob: 10b43f92e73e5075cdcf35715c3744ded812f946 (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
#!/bin/sh

# Prints some status info to stdout. Includes:
#	- date and time
#	- battery
#	- wifi (requires nmcli)
#	- past reminders, if any (requires sdep and sdep-list)

# Usage: status [separator]

sep=${1:-" | "}

time=$(date +"%H:%M")
date=$(date +"%d %B %Y, %A")

if [ "$(pulsemixer --get-mute)" -eq 1 ]; then
	volume="Audio muted"
else
	volume="Volume: $(pulsemixer --get-volume | awk '{print $1}')%%"
fi

bat="/sys/class/power_supply/BAT0"
if [ -d $bat ]; then
	battery="Battery: $(cat $bat/capacity)%% $(cat $bat/status)"
else
	battery="No battery"
fi

#network=$(nmcli device status | head -n 2 | tail -n 1 | awk '{print "Network: " $4}')
# NetworkManager has a dreadful command line interface
# It makes cry every time
# pls help
network="Network: $(nmcli device status | head -n 2 | tail -n 1 | sed 's/ *$//' | sed 's/.*  //')"

events=$(sdep-list past | wc -l)

printf "$network$sep$volume$sep$battery$sep$date$sep$time"
[ "$events" != "0" ] && printf "$sep$events TODO task(s)"
printf "\n"

Generated with cgit - Back to sebastiano.tronto.net