-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathspeak_bat_life.sh
33 lines (29 loc) · 1.55 KB
/
speak_bat_life.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
27
28
29
30
31
32
33
#!/bin/bash
. /usr/local/bin/buttonmon.sh
if [ -e "/home/ark/.config/.MBROLA_VOICE_FEMALE" ]; then
voice="1"
elif [ -e "/home/ark/.config/.MBROLA_VOICE_MALE3" ]; then
voice="3"
else
voice="2"
fi
Test_Button_R2
if [ "$?" -eq "10" ]; then
runuser -u ark -- espeak-ng -vmb-us${voice} -s130 "The current performance governor is $(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor)"
if [[ $(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor) == "userspace" ]]; then
runuser -u ark -- espeak-ng -vmb-us${voice} -s130 "CPU speed is currently $(awk 'length==6{printf("%.0f MHz\n", $0/10^3); next} length==7{printf("%.1f GHz\n", $0/10^6)}' /sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq)" &
fi
else
if [[ ! -z "$@" ]]; then
runuser -u ark -- espeak-ng -vmb-us${voice} -s130 "${@} $(cat /sys/class/power_supply/battery/capacity) percent"
else
runuser -u ark -- espeak-ng -vmb-us${voice} -s130 "Your battery level is at $(cat /sys/class/power_supply/battery/capacity) percent"
fi
Test_Button_R2
if [ "$?" -eq "10" ]; then
runuser -u ark -- espeak-ng -vmb-us${voice} -s130 "The current performance governor is $(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor)"
if [[ $(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor) == "userspace" ]]; then
runuser -u ark -- espeak-ng -vmb-us${voice} -s130 "CPU speed is currently $(awk 'length==6{printf("%.0f MHz\n", $0/10^3); next} length==7{printf("%.1f GHz\n", $0/10^6)}' /sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq)" &
fi
fi
fi