blob: fb1a9987330672ddd09b59c9210c98f336c11dd2 (
plain) (
blame)
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
64
65
66
67
68
69
70
71
72
73
74
75
|
#!/bin/sh
check_online() {
status=$(curl --silent "http://detectportal.firefox.com/success.txt")
if [ ! "$status" = "success" ]
then
printf "Disconnected"
exit 1
fi
}
strip_chars() {
tr -d \[\]\(\)%
}
case "$1" in
title)
true
;;
crypto)
check_online
change() { printf "%0.1f" "$(curl --silent --request GET --url "https://api.coincap.io/v2/assets/$1" | jq -r '.data.changePercent24Hr')" ; }
printf " %s, %s\n" "$(change monero)" "$(change nano)"
;;
backlight)
printf " %s\n" "$(brightnessctl i | awk '/Current/ {print $4}' | strip_chars)"
;;
battery)
status="$(awk -F= '/POWER_SUPPLY_STATUS/ {print $2}' /sys/class/power_supply/BAT0/uevent)"
level="$(awk -F= '/POWER_SUPPLY_CAPACITY=/ {print $2}' /sys/class/power_supply/BAT0/uevent)"
if [ "$status" = "Discharging" ]; then icon=""; else icon=""; fi
printf "%s %s\n" "$icon" "$level"
;;
date)
date=$(date '+%A %eXX %B, %H:%M' | sed -e 's/11XX/11th/' -e 's/12XX/12th/' -e 's/13XX/13th/' -e 's/1XX/1st/' -e 's/2XX/2nd/' -e 's/3XX/3rd/' -e 's/XX/th/')
printf " %s\n" "$date"
;;
disk)
printf " %s\n" "$(df / | awk '/dev/ {print $5}' | strip_chars)"
;;
mail)
check_online
printf " %s\n" "$(curl --silent --netrc-file "$SYNCDIR/docs/secure/mail_server" imaps://"$MAILSERVER" -X 'STATUS INBOX (UNSEEN)' | awk -F"[][()]" '{print substr ($2, 8 )}')"
;;
power)
printf "\n"
;;
rss)
check_online
printf " %s\n" "$(curl -Ss "https://rss.$DOMAIN/public.php?op=getUnread&login=admin")"
;;
temperature)
temperature="$(($(cat /sys/class/thermal/thermal_zone0/temp)/1000))"
printf " %s\n" "$temperature"
;;
volume)
if [ -z "$(amixer get Master | awk '/off/')" ]; then state=nomute; else state=mute; fi
volume=$(amixer get Master | awk '/%/ {print $4}' | strip_chars)
if [ "$volume" -gt 66 ]
then
icon=""
elif [ "$volume" -gt 33 ]
then
icon=""
else
icon=""
fi
if [ "$state" = "mute" ]; then icon=""; fi
printf "%s %s\n" "$icon" "$volume"
;;
wifi)
printf "\n"
;;
esac
|