home/polybar: add exchangerate module
This commit is contained in:
parent
8b18f554ca
commit
1333078a48
2 changed files with 25 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -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]} (<fc=${color}>${arror}<hspace=3/>${diff}</fc>)"
|
||||
case $bar_name in
|
||||
"xmobar")
|
||||
echo "${cc[-1]} (<fc=${color}>${arror}<hspace=3/>${diff}</fc>)"
|
||||
;;
|
||||
|
||||
"polybar")
|
||||
echo "${cc[-1]} (%{F${color}}${arror}%{O3}${diff}%{F-})"
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
|
|
Loading…
Reference in a new issue