diff --git a/programs/xmonad/xmobar/scripts/cbr.sh b/programs/xmonad/xmobar/scripts/cbr.sh
new file mode 100755
index 0000000..68c5fbf
--- /dev/null
+++ b/programs/xmonad/xmobar/scripts/cbr.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+set -e
+
+today=$(date +%d/%m/%Y)
+prev_week=$(date +%d/%m/%Y -d '-7 day')
+
+usd=R01235
+
+cc=($(curl --no-progress-meter "https://www.cbr.ru/scripts/XML_dynamic.asp?date_req1=$prev_week&date_req2=$today&VAL_NM_RQ=$usd" | \
+ sed -e "s/<[A-Z]/\n\0/g" | \
+ grep Value | \
+ sed -e "s#<\/\?\w\+>##g" | \
+ sed -e "s/,/./g"))
+
+diff=$(echo ${cc[-2]} ${cc[-1]} | awk '{ print $1 - $2 }')
+
+case $1 in
+ "diff")
+ echo $diff
+ ;;
+
+ "cur")
+ echo ${cc[-1]}
+ ;;
+
+ *)
+ echo "${cc[-1]} ($diff)"
+ ;;
+esac
+
+exit 0
+
diff --git a/programs/xmonad/xmobar/src/xmobar.hs b/programs/xmonad/xmobar/src/xmobar.hs
index b2fe495..0158ea0 100644
--- a/programs/xmonad/xmobar/src/xmobar.hs
+++ b/programs/xmonad/xmobar/src/xmobar.hs
@@ -52,7 +52,7 @@ config n = defaultConfig
, alignSep = "}{"
, template = "%XMonadLog%"
<> "} %date% %cpu% | %memory% * %swap% | %wlxd03745e1e87bwi%"
- <> "{ Vol: %volume% %kbd% %time%"
+ <> "{ USD %usdrub% (" <> green "%usdrubdiff%" <> ") Vol: %volume% %kbd% %time%"
}
myCommands :: [Runnable]
@@ -85,8 +85,9 @@ myCommands =
, "--high" , colorGreen
]
(10 `seconds`)
- , Run $ Com "/bin/bash" ["-c", "~/.config/xmobar/scripts/get_volume.sh"] "volume" 1
- -- , Run $ Com "/bin/bash" ["-c", "~/scripts/him.sh unread-count"] "emails" 60
+ , Run $ ComX "/bin/bash" ["-c", "~/.config/xmobar/scripts/get_volume.sh"] "N/A" "volume" 1
+ , Run $ ComX "/bin/bash" ["-c", "~/.config/xmobar/scripts/cbr.sh cur"] "N/A" "usdrub" (60 `seconds`)
+ , Run $ ComX "/bin/bash" ["-c", "~/.config/xmobar/scripts/cbr.sh diff"] "N/A" "usdrubdiff" (60 `seconds`)
, Run XMonadLog
]
where