feat(prog/xmonad/xmobar): add usdrub currency
This commit is contained in:
parent
6e6662bd4d
commit
9e8a454bfd
2 changed files with 37 additions and 3 deletions
33
programs/xmonad/xmobar/scripts/cbr.sh
Executable file
33
programs/xmonad/xmobar/scripts/cbr.sh
Executable file
|
@ -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
|
||||
|
|
@ -52,7 +52,7 @@ config n = defaultConfig
|
|||
, alignSep = "}{"
|
||||
, template = "%XMonadLog%"
|
||||
<> "} %date% <hspace=60/> %cpu% | %memory% * %swap% | %wlxd03745e1e87bwi%"
|
||||
<> "{ Vol: %volume% <fn=1><box> %kbd% </box> <fc=#ee9a00>%time%</fc></fn>"
|
||||
<> "{ <fn=1>USD</fn> %usdrub% (" <> green "%usdrubdiff%" <> ") <hspace=3/> Vol: %volume% <fn=1><box> %kbd% </box> <fc=#ee9a00>%time%</fc></fn>"
|
||||
}
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue