From e8273b726c1fc6e5c1e62c1081b9363bed729e66 Mon Sep 17 00:00:00 2001 From: Brayan Date: Fri, 18 Dec 2020 19:39:56 +0100 Subject: [PATCH 1/2] 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 From a307f29e7b473ca9cdf7bd097d780e81b5559f01 Mon Sep 17 00:00:00 2001 From: BdeAlbuquerque <58791261+bdealbuquerque@users.noreply.github.com> Date: Fri, 18 Dec 2020 19:50:56 +0100 Subject: [PATCH 2/2] Update new plugin dwm_currency --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index a444663..992d1d6 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ A modular statusbar for dwm - [dwm_backlight](#dwm_backlight) - [dwm_connman](#dwm_connman) - [dwm_loadavg](#dwm_loadavg) + - [dwm_currency](#dwm_currency) - [dwm_solar_panel(#dwm_solar_panel) - [Installation](#installation) - [Reccomendations](#reccomendations) @@ -162,6 +163,13 @@ Displays how much power is being produced from your solar panels ``` [💡 3.012 W ] ``` +### dwm_currency +Displays the current rate of your currency in comparison to the USD provided by [rate.sx](http://rate.sx/) +``` +[💡 1.225 ] +``` +Dependencies: ```curl``` + ## Installation 1. Clone and enter the repository: ```