From e8273b726c1fc6e5c1e62c1081b9363bed729e66 Mon Sep 17 00:00:00 2001 From: Brayan Date: Fri, 18 Dec 2020 19:39:56 +0100 Subject: [PATCH] Created dwm_currency.sh, dwm_bar.sh edited accordingly --- bar-functions/dwm_currency.sh | 23 +++++++++++++++++++++++ dwm_bar.sh | 2 ++ 2 files changed, 25 insertions(+) create mode 100644 bar-functions/dwm_currency.sh diff --git a/bar-functions/dwm_currency.sh b/bar-functions/dwm_currency.sh new file mode 100644 index 0000000..3f99042 --- /dev/null +++ b/bar-functions/dwm_currency.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +# A dwm_bar function to print the rate of CURRENCY/USD from rate.sx using rate.sx/1CURRENCY +# Creator of the project: Joe Standring +# Additional plugin added by Brayan de Albuquerque +# GNU GPLv3 + +# Dependencies: curl + +# Change the value of CURRENCY to match your currency code +dwm_currency() { + CURRENCY=EUR + + printf "%s" "$SEP1" + if [ "$IDENTIFIER" = "unicode" ]; then + printf "%s" "$(curl -s rate.sx/1$CURRENCY)" + else + printf "%s %.5s" "$CURRENCY" "$(curl -s rate.sx/1$CURRENCY)" + fi + printf "%s\n" "$SEP2" +} + +dwm_currency diff --git a/dwm_bar.sh b/dwm_bar.sh index 3efbc2e..b983b19 100755 --- a/dwm_bar.sh +++ b/dwm_bar.sh @@ -42,6 +42,7 @@ export SEP2="]" . "$DIR/bar-functions/dwm_date.sh" . "$DIR/bar-functions/dwm_connman.sh" . "$DIR/bar-functions/dwm_loadavg.sh" +. "$DIR/bar-functions/dwm_currency.sh" # Update dwm status bar every second while true @@ -69,6 +70,7 @@ do dispstr="$dispstr$(dwm_ccurse)" dispstr="$dispstr$(dwm_date)" dispstr="$dispstr$(dwm_loadavg)" + dispstr="$dispstr$(dwm_currency)" xsetroot -name "$dispstr" sleep 1