diff --git a/home/ui/bar/polybar/config.nix b/home/ui/bar/polybar/config.nix index 08ade6f..ffd8b07 100644 --- a/home/ui/bar/polybar/config.nix +++ b/home/ui/bar/polybar/config.nix @@ -15,7 +15,7 @@ with lib; modules = { left = "xmonad"; center = "date wifi"; - right = "volume lang time"; + right = "exchangerate volume lang time"; }; }; @@ -76,6 +76,17 @@ with lib; tail = true; }; + "module/exchangerate" = { + type = "custom/script"; + exec = "~/scripts/exchangerate.sh"; + interval = 60; + format = { + prefix = "USD: "; + padding = 1; + }; + + }; + "global/wm" = { margin = { bottom = 0; diff --git a/scripts/exchangerate.sh b/scripts/exchangerate.sh index 06ac57f..bb2002c 100755 --- a/scripts/exchangerate.sh +++ b/scripts/exchangerate.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -e @@ -24,6 +24,9 @@ curl_exchangerate () { sed -e "s#<\/\?\w\+>##g" } +# bar_name=xmobar +bar_name=polybar + cc=($(curl_cbr)) diff=$(echo ${cc[-1]} ${cc[-2]} | awk '{ print $1 - $2 }') @@ -35,7 +38,15 @@ if [ ${diff:0:1} == '-' ]; then color='#ff5555' fi -echo "${cc[-1]} (${arror}${diff})" +case $bar_name in + "xmobar") + echo "${cc[-1]} (${arror}${diff})" + ;; + + "polybar") + echo "${cc[-1]} (%{F${color}}${arror}%{O3}${diff}%{F-})" + ;; +esac exit 0