]> git.armaanb.net Git - bin.git/blob - status
e5e5138fbdd3f449cedf39237dc6d725f39ae318
[bin.git] / status
1 #!/usr/bin/env bash
2 # Sends a notification with the time, battery level, and volume
3
4 time_set() {
5   date "+%A %Y-%m-%d, %r"
6 }
7
8 power_set() {
9   echo -n "$(upower -d | grep percentage | tail -c 5)"
10   if [[ $(upower -d | grep "discharging") ]]; then
11     echo -n " battery,"
12     echo "$(upower -d | grep "time to empty" | tail -c 15) remaining"
13   else
14     echo -n " battery,"
15     echo "$(upower -d | grep "time to full" | tail -c 15) until charged"
16   fi
17 }
18
19 volume_set() {
20   echo "$(amixer sget Master | tail -n 1 | tail -c +21)"
21 }
22
23 notify-send "$(time_set)" "$(power_set)\n$(volume_set)"