From 6cc138acc66a6b5d8cbc4d535f201fd48e8b6b4a Mon Sep 17 00:00:00 2001 From: Felipe M Date: Tue, 2 Feb 2021 15:47:47 +0100 Subject: [PATCH] Updated swaybar script --- .config/sway/swaybar.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.config/sway/swaybar.sh b/.config/sway/swaybar.sh index 7b636e5..c64fe0d 100755 --- a/.config/sway/swaybar.sh +++ b/.config/sway/swaybar.sh @@ -1,6 +1,8 @@ #!/bin/bash # vim: ts=4 +source $HOME/.secrets/finnhub + function getPowerValue() { POWER=$(cat /sys/class/power_supply/BAT0/capacity)% echo $POWER @@ -23,8 +25,16 @@ 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 +} + while [ True ]; do - echo "$(getVolume) | $(getPowerValue)$(getPowerStatus) | $(getDate)" + echo "$(getNextEvent) | $(getStock AMC) . $(getStock GME) | $(getVolume) | $(getPowerValue)$(getPowerStatus) | $(getDate)" sleep 30 done