refac(prog/xmonad/xmobar): better styles for diff

This commit is contained in:
Dmitriy Pleshevskiy 2022-05-27 16:04:30 +03:00
parent 1a6c159f0b
commit 95a5803b5f
2 changed files with 7 additions and 16 deletions

View file

@ -14,20 +14,12 @@ cc=($(curl --no-progress-meter "https://www.cbr.ru/scripts/XML_dynamic.asp?date_
sed -e "s/,/./g"))
diff=$(echo ${cc[-2]} ${cc[-1]} | awk '{ print $1 - $2 }')
color='#50fa7b'
if [ ${diff:0:1} == '-' ]; then
color='#ff5555'
fi
case $1 in
"diff")
echo $diff
;;
"cur")
echo ${cc[-1]}
;;
*)
echo "${cc[-1]} ($diff)"
;;
esac
echo "${cc[-1]} (<fc=${color}>$diff</fc>)"
exit 0

View file

@ -52,7 +52,7 @@ config n = defaultConfig
, alignSep = "}{"
, template = "%XMonadLog%"
<> "} %date% <hspace=60/> %multicpu% | %memory% * %swap% | %wlxd03745e1e87bwi%"
<> "{ <fn=1>USD</fn> %usdrub% (" <> green "%usdrubdiff%" <> ") <hspace=3/> Vol: %volume% <fn=1><box> %kbd% </box> <fc=#ee9a00>%time%</fc></fn>"
<> "{ <fn=1>USD</fn> %usdrub% <hspace=3/> Vol: %volume% <fn=1><box> %kbd% </box> <fc=#ee9a00>%time%</fc></fn>"
}
myCommands :: [Runnable]
@ -86,8 +86,7 @@ myCommands =
]
(10 `seconds`)
, 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 $ ComX "/bin/bash" ["-c", "~/.config/xmobar/scripts/cbr.sh"] "N/A" "usdrub" (60 `seconds`)
, Run XMonadLog
]
where