44 lines
952 B
Bash
Executable File
44 lines
952 B
Bash
Executable File
#!/bin/bash
|
|
# vim: ts=4
|
|
|
|
source $HOME/.secrets/finnhub
|
|
|
|
function getPowerValue() {
|
|
POWER=$(cat /sys/class/power_supply/BAT0/capacity)%
|
|
echo $POWER
|
|
}
|
|
|
|
function getPowerStatus() {
|
|
POWERSTATUS=$(cat /sys/class/power_supply/BAT0/status)
|
|
if [ "$POWERSTATUS" == "Charging" ]; then
|
|
echo "+"
|
|
elif [ "$POWERSTATUS" == "Discharging" ]; then
|
|
echo "-"
|
|
fi
|
|
}
|
|
|
|
function getDate() {
|
|
echo $(date +'%Y-%m-%d %H:%M')
|
|
}
|
|
|
|
function getVolume() {
|
|
echo $(amixer get Master | grep 'Left:' | awk -F"[][]" '{ print $2 }')
|
|
}
|
|
|
|
function getStock() {
|
|
curl -s "https://finnhub.io/api/v1/quote?symbol=$1&token=$SECRET_FINNHUB_TOKEN" | jq ".c"
|
|
}
|
|
|
|
function getNextEvent() {
|
|
khal list now -df "" | grep -v "^ " | head -n 1
|
|
}
|
|
|
|
function getCurrentSong() {
|
|
echo $(playerctl metadata artist) - $(playerctl metadata title)
|
|
}
|
|
|
|
while [ True ]; do
|
|
echo "$(getCurrentSong) | $(getNextEvent) | $(getVolume) | $(getPowerValue)$(getPowerStatus) | $(getDate)"
|
|
sleep 30
|
|
done
|